Region-based gradient calculation in different motion vector refinement

By employing region-based gradient calculation and optical flow prediction refinement techniques during video encoding and decoding, the problems of efficiency and bandwidth requirements in high-resolution video encoding and decoding are solved, achieving more efficient video processing and quality improvement.

CN118540470APending Publication Date: 2024-08-23DOUYIN VISION CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311434272.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-06-25
Filing Date
2020-04-20
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing video encoding and decoding technologies still have room for improvement in terms of encoding and decoding efficiency and bandwidth requirements when processing high-resolution video, especially on the Internet and digital communication networks, where existing standards are struggling to meet the ever-increasing bandwidth demands and video quality requirements.

Method used

A region-based gradient calculation method is adopted, and the prediction accuracy of video blocks is improved by using affine mode motion compensation and optical flow prediction refinement techniques. The transformation is performed during the encoding and decoding process, and bidirectional optical flow and decoder-side motion vector refinement techniques are used to optimize the video encoding and decoding process.

Benefits of technology

It improves video encoding and decoding efficiency, reduces bandwidth requirements, enhances video quality, and optimizes the complexity and error resistance of the encoding algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540470A
    Figure CN118540470A
Patent Text Reader

Abstract

The invention provides region-based gradient calculation in different motion vector refinement. There is provided a video processing method comprising: determining a final prediction block for a current video block of a video by refining one or more initial predictions of the current video block using optical flow calculations based on a gradient of initial prediction samples according to a precision rule for the current video block; and performing a conversion between the current video block and the encoded representation using the final prediction block, in which the optical flow calculation includes a prediction refinement (PROF) process or a bidirectional optical flow (BDOF) process with optical flow, in which a precision rule specifies a gradient using the same precision for representing both the PROF process and the BDOF process.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is a divisional application of the invention patent application with application date of April 20, 2020, application number 202080029821.1, and invention name “Region-based gradient calculation in different motion vector refinement”. Technical Field

[0003] This patent document relates to video processing technology, equipment and systems. Background Art

[0004] Despite advances in video compression technology, digital video still accounts for the largest use of bandwidth on the Internet and other digital communications networks. As the number of networked user devices capable of receiving and displaying video increases, bandwidth demand for digital video usage is expected to continue to grow. Summary of the invention

[0005] Devices, systems and methods related to digital video processing. The described methods can be applied to existing video coding standards (eg, High Efficiency Video Coding (HEVC)) and future video coding standards or video codecs.

[0006] In one representative aspect, the disclosed technology can be used to provide a method for video processing. The method includes: using affine mode motion compensation performed at a sub-block level of a current video block of a video to generate a prediction block of the current video block; performing gradient calculations on a region of the current video block to refine the prediction block using a prediction refinement (PROF) process using optical flow, wherein the size (M×N) of the region is different from the size of the sub-block of the current video block, wherein M and N are positive integers; and performing conversion between the current video block and a codec representation of the video based on the gradient calculations.

[0007] In another representative aspect, the disclosed technology can be used to provide a method for video processing. The method includes: deriving a final prediction block for a current video block of a video having a first size, wherein the final prediction block is calculated by refining one or more intermediate prediction blocks using a gradient calculation performed on a video region having a second size according to a rule, wherein the refinement uses an optical flow process; and performing a conversion between the current video block and a codec representation of the video using the final prediction block.

[0008] In another representative aspect, the disclosed technology can be used to provide a method for video processing. The method includes: deriving motion information for a current video block of a video using bidirectional optical flow (BDOF) or prediction refinement using optical flow (PROF); performing gradient calculations on samples in a region of the current video block such that at least one sample in the region is omitted from the gradient calculations; and performing conversion between the current video block and a codec representation of a video including the current video block based on the gradient calculations, wherein one or more initial predictions of the current video block are calculated at a sub-block level and refined using optical flow calculations during PROF, or one or more initial predictions are refined using spatial and temporal gradients during BDOF.

[0009] In another representative aspect, the disclosed technology can be used to provide a method for video processing. The method includes: refining one or more initial predictions of a current video block of a video based on gradients of initial prediction samples according to a precision rule using optical flow calculation, determining a final prediction block of the current video block for the current video block; and performing a conversion between the current video block and a codec representation using the final prediction block, wherein the optical flow calculation includes a prediction refinement (PROF) process or a bidirectional optical flow (BDOF) process using optical flow, wherein the precision rule specifies using the same precision for representing gradients of both the PROF process and the BDOF process.

[0010] In another representative aspect, the disclosed technology can be used to provide a method for video processing. The method includes: refining one or more initial predictions of a current video block of a video by using optical flow calculation, determining a final prediction block of the current video block for conversion between the current video block and a codec representation of the video; and performing the conversion using the final prediction block, wherein the optical flow calculation includes using a prediction refinement of optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process, wherein the optical flow calculation also includes a padding operation applied to at least one of the PROF process or the BDOF process according to a rule to derive padding samples.

[0011] In yet another representative aspect, the above method is embodied in the form of processor executable code and stored in a computer readable program medium.

[0012] In yet another representative aspect, a device configured or operable to perform the above method is disclosed. The device may include a processor programmed to implement the method.

[0013] In yet another representative aspect, a video decoder device may implement a method as described herein.

[0014] The above and other aspects and features of the disclosed technology are described in more detail in the drawings, the description, and the claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 An example of constructing a Merge candidate list is shown.

[0016] Figure 2 Examples of locations of spatial candidates are shown.

[0017] Figure 3 An example of candidate pairs for which redundancy check of spatial merge candidates is performed is shown.

[0018] Figure 4A and Figure 4B An example of the position of the second prediction unit (PU) based on the size and shape of the current block is shown.

[0019] Figure 5 An example of motion vector scaling for temporal merge candidates is shown.

[0020] Figure 6 An example of candidate positions of time-domain Merge candidates is shown.

[0021] Figure 7 An example of generating a combined bi-predictive Merge candidate is shown.

[0022] Figure 8 An example of constructing motion vector prediction candidates is shown.

[0023] Fig. 9 An example of motion vector scaling for spatial motion vector candidates is shown.

[0024] Fig.10 An example of motion prediction using an Alternative Temporal Motion Vector Prediction (ATMVP) algorithm for a Coding Unit (CU) is shown.

[0025] Fig.11 An example of a codec unit (CU) with sub-blocks and neighboring blocks used by a Spatial-Temporal Motion Vector Prediction (STMVP) algorithm is shown.

[0026] Fig. 12A and 12BExample snapshots of sub-blocks are shown when an overlapped block motion compensation (OBMC) algorithm is used.

[0027] Fig.13 An example of neighboring samples used to derive parameters for a local illumination compensation (LIC) algorithm is shown.

[0028] Fig.14 An example of a simplified affine motion model is shown.

[0029] Fig.15 An example of an affine motion vector field (MVF) for each sub-block is shown.

[0030] Fig.16 An example of motion vector prediction (MVP) for AF_INTER affine motion mode is shown.

[0031] Fig.17A and Fig. 17B Example candidates for the AF_MERGE affine motion mode are shown.

[0032] Fig.18 An example of bilateral matching in the Pattern Matched Motion Vector Derivation (PMMVD) mode, which is a special Merge mode based on the Frame Rate Up-Conversion (FRUC) algorithm, is shown.

[0033] Fig.19 An example of template matching in the FRUC algorithm is shown.

[0034] Fig. 20 An example of unilateral motion estimation in the FRUC algorithm is shown.

[0035] Fig.21 An example of an optical flow trajectory used by the Bidirectional Optical Flow (BIO) algorithm is shown.

[0036] Fig.22A and Fig. 22B An example snapshot using the Bidirectional Optical Flow (BIO) algorithm without block expansion is shown.

[0037] Fig.23 An example of interpolation samples used in BIO is shown.

[0038] Fig.24 An example of a decoder-side motion vector refinement (DMVR) algorithm based on bilateral template matching is shown.

[0039] Fig.25 An example of a sub-block MV VSB and a pixel Δv(i,j) is shown.

[0040] Fig.26 An example of phase-varying horizontal filtering is shown.

[0041] Fig. 27 An example of one instance of applying 8-tap horizontal filtering is shown.

[0042] Fig.28 An example of non-uniform phase vertical filtering is shown.

[0043] FIG. 29A to FIG. 29E A flow chart of an example method for video processing is shown.

[0044] Fig. 30A and Fig. 30B is a block diagram of an example of a hardware platform for implementing the visual media decoding or visual media encoding techniques described in this document.

[0045] Fig.31 An example of 16 4x4 sub-blocks in a 16x16 area is shown. DETAILED DESCRIPTION

[0046] Due to the growing demand for higher resolution video, video processing methods and techniques are ubiquitous in modern technology. Video codecs typically include electronic circuits or software that compress or decompress digital video, and are constantly being improved to provide higher codec efficiency. Video codecs convert uncompressed video to a compressed format and vice versa. There is a complex relationship between video quality, the amount of data used to represent the video (determined by the bit rate), the complexity of the encoding and decoding algorithms, sensitivity to data loss and errors, ease of editing, random access, and end-to-end delay (latency). The compression format usually conforms to a standard video compression specification, such as the High Efficiency Video Codec (HEVC) standard (also known as H.265 or MPEG-H Part 2), the to-be-completed general video codec standard, or other current and / or future video codec standards.

[0047] Embodiments of the disclosed technology can be applied to existing video codec standards (e.g., HEVC, H.265) and future standards to improve compression performance. Section headings are used in this document to improve the readability of the description and do not in any way limit the discussion or embodiments (and / or implementation methods) to only the corresponding sections.

[0048] 1. Example of inter-frame prediction in HEVC / H.265

[0049] Video codec standards have improved significantly in recent years and now partially provide high codec efficiency and support for higher resolutions. Recent standards such as HEVC and H.265 are based on a hybrid video codec structure, where temporal prediction plus transform coding is utilized.

[0050] 1.1 Example of prediction mode

[0051] Each inter-prediction PU (prediction unit) has motion parameters for one or two reference picture lists. In some embodiments, the motion parameters include motion vectors and reference picture indexes. In other embodiments, the use of one of the two reference picture lists may also be signaled using inter_pred_idc. In other embodiments, the motion vector may be explicitly encoded and decoded as a delta relative to the predicted value.

[0052] When a CU is encoded or decoded in skip mode, one PU is associated with the CU and there are no significant residual coefficients, no coded motion vector increments or reference picture indices. A Merge mode is specified, whereby the motion parameters of the current PU are obtained from neighboring PUs including spatial and temporal candidates. Merge mode can be applied to any inter-predicted PU, not just for skip mode. An alternative to Merge mode is explicit transmission of motion parameters, where the motion vectors, the corresponding reference picture indices for each reference picture list, and the reference picture list usage are explicitly signaled per PU.

[0053] When signaling indicates that one of the two reference picture lists is to be used, a PU is generated from one block of samples. This is called "unidirectional prediction". Unidirectional prediction applies to both P slices and B slices.

[0054] When signaling indicates that two reference picture lists are to be used, a PU is generated from two sample blocks. This is called "bi-prediction". Bi-prediction is only applicable to B slices.

[0055] 1.1.1 Example of constructing a candidate for Merge mode

[0056] When predicting a PU using Merge mode, the index pointing to the entry in the Merge candidate list is parsed from the bitstream and used to retrieve the motion information. The construction of this list can be summarized according to the following sequence of steps:

[0057] Step 1: Initial candidate derivation

[0058] Step 1.1: Spatial Candidate Derivation

[0059] Step 1.2: Redundancy check of spatial candidates

[0060] Step 1.3: Time Domain Candidate Derivation

[0061] Step 2: Additional candidate insertions

[0062] Step 2.1: Create bidirectional prediction candidates

[0063] Step 2.2: Insert zero motion candidates

[0064] Figure 1 An example of constructing a Merge candidate list based on the sequence of steps summarized above is shown. For spatial Merge candidate derivation, up to four Merge candidates are selected from candidates located at five different positions. For temporal Merge candidate derivation, up to one Merge candidate is selected from two candidates. Since the number of candidates for each PU is assumed to be constant at the decoder, additional candidates are generated when the number of candidates does not reach the maximum number of Merge candidates (MaxNumMergeCand) signaled in the slice header. Since the number of candidates is constant, the index of the best Merge candidate is encoded using truncated unary (TU). If the size of the CU is equal to 8, all PUs of the current CU share a single Merge candidate list, which is the same as the Merge candidate list of a 2N×2N prediction unit.

[0065] 1.1.2 Constructing Spatial Merge Candidates

[0066] In the derivation of spatial domain merge candidates, we start from Figure 2 Select up to four Merge candidates from the candidates for the positions depicted in . The order of derivation is A 1 , B 1 , B 0 , A 0 and B 2 Only when position A 1 , B 1 , B 0 , A 0 Position B is considered only when any PU of 2 At position A 1 After the candidate at is added, a redundancy check is performed on the addition of the remaining candidates, and the redundancy check ensures that the candidates with the same motion information are excluded from the list, thereby improving the encoding and decoding efficiency.

[0067] In order to reduce computational complexity, not all possible candidate pairs are considered in the mentioned redundancy check. Instead, only the pairs in Figure 3 , and only when the candidates used for redundancy check do not have the same motion information, the corresponding candidate is added to the list. Another source of repeated motion information is a "second PU" associated with a partition other than 2N×2N. As an example, Figure 4A and Figure 4B The second PU for the N×2N and 2N×N cases is depicted respectively. When the current PU is partitioned into N×2N, position A 1The candidate at position B is not considered for list construction. In some embodiments, adding this candidate may result in two prediction units having the same motion information, which is redundant for having only one PU in the codec unit. Similarly, when the current PU is split into 2N×N, position B is not considered. 1 .

[0068] 1.1.3 Constructing Time Domain Merge Candidates

[0069] In this step, only one candidate is added to the list. Specifically, in the derivation of the temporal Merge candidate, the scaled motion vector is derived based on the collocated PU belonging to the picture with the minimum POC difference with the current picture in the given reference picture list. The reference picture list to be used for the derivation of the collocated PU is explicitly signaled in the slice header.

[0070] Figure 5 An example of the derivation of a scaled motion vector for a temporal Merge candidate is shown (as indicated by the dashed line), which is scaled from the motion vector of the collocated PU using the POC distances tb and td, where tb is defined as the POC difference between the reference picture of the current picture and the current picture, and td is defined as the POC difference between the reference picture of the collocated picture and the collocated picture. The reference picture index of the temporal Merge candidate is set to zero. For B slices, two motion vectors are obtained, one for reference picture list 0 and the other for reference picture list 1, and are combined to form a bidirectional prediction Merge candidate.

[0071] like Figure 6 As depicted, in the collocated PU(Y) belonging to the reference frame, in the candidate C 0 and C 1 Select the time domain candidate position between. If the position C 0 If the PU at position C is not available, is intra-coded, or is outside the current CTU, then position C is used. 1 Otherwise, position C is used in the derivation of the time-domain Merge candidate 0 .

[0072] 1.1.4 Constructing additional types of merge candidates

[0073] In addition to the space-time Merge candidates, there are two additional types of Merge candidates: combined bidirectional prediction Merge candidates and zero Merge candidates. Combined bidirectional prediction Merge candidates are generated by utilizing space-time Merge candidates. Combined bidirectional prediction Merge candidates are only used for B slices. Combined bidirectional prediction candidates are generated by combining the first reference picture list motion parameters of the initial candidate with the second reference picture list motion parameters of another. If the two tuples provide different motion hypotheses, they will form a new bidirectional prediction candidate.

[0074] Figure 7 An example of this process is shown where two candidates in the original list (710, on the left) with mvL0 and refIdxL0 or mvL1 and refIdxL1 are used to create a combined bi-predictive Merge candidate that is added to the final list (720, on the right).

[0075] Zero motion candidates are inserted to fill the remaining entries in the Merge candidate list and thus reach the MaxNumMergeCand capacity. These candidates have zero spatial displacement and a reference picture index that starts at zero and increases each time a new zero motion candidate is added to the list. The number of reference frames used by these candidates is one for unidirectional prediction and two for bidirectional prediction, respectively. In some embodiments, no redundancy check is performed on these candidates.

[0076] 1.1.5 Example of motion estimation regions for parallel processing

[0077] To speed up the encoding process, motion estimation can be performed in parallel, thereby deriving motion vectors for all prediction units within a given region at the same time. Deriving Merge candidates from spatial neighbors may interfere with parallel processing because one prediction unit cannot derive motion parameters from neighboring PUs until its associated motion estimation is completed. To ease the trade-off between codec efficiency and processing latency, a motion estimation region (MER) can be defined. The size of the MER can be signaled in the picture parameter set (PPS) using the "log2_parallel_merge_level_minus2" syntax element. When a MER is defined, Merge candidates that fall into the same region are marked as unavailable and are therefore not considered in list construction.

[0078] 1.2 Embodiment of Advanced Motion Vector Prediction (AMVP)

[0079] AMVP exploits the spatio-temporal correlation of motion vectors with neighboring PUs for explicit transmission of motion parameters. A motion vector candidate list is constructed by first checking the availability of the left and upper time domain neighboring PU positions, removing redundant candidates, and adding zero vectors to make the candidate list length constant. The encoder can then select the best prediction value from the candidate list and send the corresponding index indicating the selected candidate. Similar to Merge index signaling, the index of the best motion vector candidate is encoded using truncated unary coding. In this case, the maximum value to be encoded is 2 (see Figure 8 ). In the following sections, details about the derivation process of motion vector prediction candidates are provided.

[0080] 1.2.1 Example of constructing motion vector prediction candidates

[0081] Figure 8 The derivation process of motion vector prediction candidates is summarized and can be implemented for each reference picture list with refidx as input.

[0082] In motion vector prediction, two types of motion vector candidates are considered: spatial motion vector candidates and temporal motion vector candidates. For spatial motion vector candidate derivation, based on the location as previously described, Figure 2 The motion vectors of each PU at the five different positions shown in are used to finally derive two motion vector candidates.

[0083] For temporal motion vector candidate derivation, select a motion vector candidate from two candidates that are derived based on two different collocated positions. After generating the first list of spatio-temporal candidates, remove duplicate motion vector candidates in the list. If the number of potential candidates is greater than 2, remove motion vector candidates with reference picture indices greater than 1 from the associated reference picture list. If the number of spatio-temporal motion vector candidates is less than two, add an additional zero motion vector candidate to the list.

[0084] 1.2.2 Constructing Spatial Motion Vector Candidates

[0085] In the derivation of spatial motion vector candidates, at most two candidates are considered among five potential candidates, which are selected from the candidate located as previously described. Figure 2 The derivation order of the left side of the current PU is defined as A 0 , A 1 and scaled A 0 , scaled A 1 The derivation order of the upper side of the current PU is defined as B 0 , B 1 , B 2 , scaled B 0, scaled B 1 , scaled B 2 Therefore, for each side, there are four cases that can be used as motion vector candidates, two of which do not require spatial scaling and two of which use spatial scaling. The four different cases are summarized as follows:

[0086] --No airspace scaling

[0087] (1) Same reference picture list and same reference picture index (same POC)

[0088] (2) Different reference picture lists but same reference pictures (same POC)

[0089] --Airspace scaling

[0090] (3) Same reference picture list but different reference pictures (different POC)

[0091] (4) Different reference picture lists and different reference pictures (different POCs)

[0092] First check the case of no spatial scaling, then check the case of spatial scaling allowed. Regardless of the reference picture list, spatial scaling is considered when the POC between the reference picture of the neighboring PU and the reference picture of the current PU is different. If all PUs of the left candidate are unavailable or intra-coded, scaling of the upper motion vector is allowed to help parallel derivation of the left and upper MV candidates. Otherwise, spatial scaling of the upper motion vector is not allowed.

[0093] like Fig. 9 As shown in the example in , for the spatial scaling case, the motion vectors of the neighboring PUs are scaled in a similar way to the temporal scaling. One difference is that the reference picture list and the index of the current PU are given as input; the actual scaling process is the same as the scaling process for temporal scaling.

[0094] 1.2.3 Constructing temporal motion vector candidates

[0095] Except for the reference picture index derivation, all the processes used to derive the temporal Merge candidate are the same as those used to derive the spatial motion vector candidate (e.g. Figure 6 In some embodiments, the reference picture index is signaled to the decoder.

[0096] 2. Example of inter prediction method in Joint Exploration Model (JEM)

[0097] In some embodiments, a reference software called Joint Exploration Model (JEM) is used to explore future video codec technologies. In JEM, sub-block based prediction is adopted in several codec tools, such as affine prediction, optional temporal motion vector prediction, spatio-temporal motion vector prediction, bi-directional optical flow (BIO), frame rate up conversion (FRUC), locally adaptive motion vector resolution (LAMVR), overlapped block motion compensation (OBMC), local illumination compensation (LIC), and decoder-side motion vector refinement (DMVR).

[0098] 2.1 Example of motion vector prediction based on sub-CU

[0099] In JEM with QuadTrees plus Binary Trees (QTBT), each CU can have at most one motion parameter set for each prediction direction. In some embodiments, two sub-CU level motion vector prediction methods are considered in the encoder by dividing the large CU into sub-CUs and deriving the motion information of all sub-CUs of the large CU. The optional temporal motion vector prediction (ATMVP) method allows each CU to obtain multiple motion information sets from multiple blocks smaller than the current CU in the collocated reference picture. In the space-time motion vector prediction (STMVP) method, the motion vector of the sub-CU is recursively derived by using the temporal motion vector prediction value and the spatial neighboring motion vector. In some embodiments, in order to retain a more accurate motion field for sub-CU motion prediction, motion compression of the reference frame can be disabled.

[0100] 2.1.1 Example of Alternative Temporal Motion Vector Prediction (ATMVP)

[0101] In the ATMVP method, the temporal motion vector prediction (TMVP) method is modified by acquiring multiple motion information sets (including motion vectors and reference indices) from blocks smaller than the current CU.

[0102] Fig.10An example of the ATMVP motion prediction process for CU 1000 is shown. The ATMVP method predicts the motion vector of sub-CU 1001 within CU 1000 in two steps. The first step is to identify the corresponding block 1051 in the reference picture 1050 with the time domain vector. The reference picture 1050 is also called a motion source picture. The second step is to divide the current CU 1000 into sub-CUs 1001 and obtain the motion vector and reference index of each sub-CU from the block corresponding to each sub-CU.

[0103] In the first step, the reference picture 1050 and the corresponding block are determined by the motion information of the spatial neighboring blocks of the current CU 1000. In order to avoid repeated scanning of neighboring blocks, the first Merge candidate in the Merge candidate list of the current CU 1000 is used. The first available motion vector and its associated reference index are set to the temporal vector and index of the motion source picture. In this way, the corresponding block can be identified more accurately compared to TMVP, where the corresponding block (sometimes referred to as a collocated block) is always at the lower right or center position relative to the current CU.

[0104] In the second step, the corresponding blocks of the sub-CU 1051 are identified by the time domain vector in the motion source picture 1050 by adding the time domain vector to the coordinates of the current CU. For each sub-CU, the motion information of its corresponding block (e.g., the minimum motion grid covering the center sample) is used to derive the motion information of the sub-CU. After the motion information of the corresponding N×N block is identified, it is converted into the motion vector and reference index of the current sub-CU in the same way as the TMVP of HEVC, where motion scaling and other processes are applied. For example, the decoder checks whether the low latency condition is met (e.g., the POC of all reference pictures of the current picture is less than the POC of the current picture), and may use the motion vector MVx (e.g., the motion vector corresponding to the reference picture list X) to predict the motion vector MVy of each sub-CU (e.g., where X is equal to 0 or 1, and Y is equal to 1-X).

[0105] 2.1.2 Example of Space-Temporal Motion Vector Prediction (STMVP)

[0106] In the STMVP method, the motion vector of a sub-CU is recursively derived in raster scan order.

[0107] Fig.11 An example of a CU with four sub-blocks and neighboring blocks is shown. Consider an 8×8 CU 1100, which includes four 4×4 sub-CUs A (1101), B (1102), C (1103) and D (1104). The neighboring 4×4 blocks in the current frame are labeled a (1111), b (1112), c (1113) and d (1114).

[0108] The motion derivation of sub-CU A starts with identifying its two spatial neighbors. The first neighbor is the N×N block (block c 1113) on the upper side of sub-CU A1101. If block c (1113) is not available or is intra-coded, check the other N×N blocks on the upper side of sub-CU A (1101) (from left to right, starting from block c 1113). The second neighbor is the block on the left side of sub-CU A 1101 (block b 1112). If block b (1112) is not available or is intra-coded, check the other blocks on the left side of sub-CU A 1101 (from top to bottom, starting from block b 1112). The motion information obtained from the neighboring blocks of each list is scaled to the first reference frame of the given list. Next, the temporal motion vector predictor (TMVP) of sub-block A 1101 is derived by following the same process as the TMVP derivation specified in HEVC. The motion information of the collocated block at block D 1104 is obtained and scaled accordingly. Finally, after retrieving and scaling the motion information, all available motion vectors are averaged separately for each reference list. The average motion vector is designated as the motion vector of the current sub-CU.

[0109] 2.1.3 Example of Sub-CU Motion Prediction Mode Signaling

[0110] In some embodiments, sub-CU modes are enabled as additional Merge candidates, and no additional syntax elements are required to signal these modes. Two additional Merge candidates are added to the Merge candidate list of each CU to represent the ATMVP mode and the STMVP mode. In other embodiments, if the sequence parameter set indicates that ATMVP and STMVP are enabled, up to seven Merge candidates can be used. The encoding logic of the additional Merge candidates is the same as that of the Merge candidates in HM, which means that for each CU in a P slice or B slice, two additional Merge candidates may also require two RD checks. In some embodiments, such as JEM, all bins of the Merge index are context-coded by CABAC (Context-based Adaptive Binary Arithmetic Coding). In other embodiments, such as HEVC, only the first bin is context-coded, and the remaining bins are context-bypass coded.

[0111] 2.2 Example of Adaptive Motion Vector Difference Resolution

[0112] In some embodiments, when use_integer_mv_flag is equal to 0 in the slice header, the motion vector difference (MVD) (between the motion vector of the PU and the predicted motion vector) is signaled in units of quarter luma samples. In JEM, local adaptive motion vector resolution (LAMVR) is introduced. In JEM, MVD can be encoded and decoded in units of quarter luma samples, integer luma samples, or four luma samples. The MVD resolution is controlled at the codec unit (CU) level, and the MVD resolution flag is conditionally signaled for each CU with at least one non-zero MVD component.

[0113] For a CU with at least one non-zero MVD component, a first flag is signaled to indicate whether quarter luma sample MV precision is used in the CU. When the first flag (equal to 1) indicates that quarter luma sample MV precision is not used, another flag is signaled to indicate whether integer luma sample MV precision or quad luma sample MV precision is used.

[0114] When the first MVD resolution flag of a CU is zero or is not coded for the CU (meaning that all MVDs in the CU are zero), a quarter luma sample MV resolution is used for the CU. When the CU uses integer luma sample MV precision or four luma sample MV precision, the MVP in the AMVP candidate list of the CU is rounded to the corresponding precision.

[0115] In the encoder, the CU-level RD check is used to determine which MVD resolution to use for the CU. That is, for each MVD resolution, three CU-level RD checks are performed. In order to speed up the encoder, the following encoding scheme is applied in JEM:

[0116] -- During RD check of a CU with normal quarter luma sample MVD resolution, store the motion information of the current CU (integer luma sample accuracy). The stored motion information (after rounding) is used as a starting point for further small-scale motion vector refinement during RD check for the same CU with integer luma sample and 4 luma sample MVD resolution, so that the time-consuming motion estimation process is not repeated three times.

[0117] --Conditionally call RD check for CU with 4 luma sample MVD resolution. For a CU, when the RD cost of integer luma sample MVD resolution is much greater than the RD cost of quarter luma sample MVD resolution, skip the RD check for CU's 4 luma sample MVD resolution.

[0118] 2.3 Example of Higher Motion Vector Storage Accuracy

[0119] In HEVC, the motion vector precision is quarter pixel (quarter luma sample and eighth chroma sample for 4:2:0 video). In JEM, the precision of internal motion vector storage and Merge candidates is increased to 1 / 16 pixel. Higher motion vector precision (1 / 16 pixel) is used for motion compensated inter prediction of CUs coded and decoded in Skip / Merge mode. For CUs coded and decoded in normal AMVP mode, integer pixel or quarter pixel motion is used.

[0120] The SHVC upsampling interpolation filter with the same filter length and normalization factor as the HEVC motion compensation interpolation filter is used as the motion compensation interpolation filter for the additional fractional pixel positions. The chroma component motion vector precision is 1 / 32 samples in JEM, and the additional interpolation filter for the 1 / 32 pixel fractional position is derived by averaging two adjacent filters at 1 / 16 pixel fractional positions.

[0121] 2.4 Example of Overlapped Block Motion Compensation (OBMC)

[0122] In JEM, OBMC can be turned on and off using CU-level syntax. When OBMC is used in JEM, OBMC is performed on all motion compensation (MC) block boundaries, except the right and bottom boundaries of the CU. In addition, it is applied to luminance and chrominance components. In JEM, MC blocks correspond to codec blocks. When a CU is encoded and decoded with sub-CU modes (including Sub-CU Merge, Affine, and FRUC (Frame Rate Up Conversion) modes), each sub-block of the CU is an MC block. In order to handle CU boundaries in a unified manner, OBMC is performed for all MC block boundaries at the sub-block level, where the sub-block size is set equal to 4×4, as Fig. 12A and Fig. 12B shown.

[0123] Fig. 12A The sub-blocks at the CU / PU boundary are shown, and the hatched sub-blocks are where OBMC is applied. Fig. 12B The sub-blocks in ATMVP mode are shown.

[0124] When OBMC is applied to the current sub-block, in addition to the current motion vector, the motion vectors of four connected neighboring sub-blocks (if available and different from the current motion vector) are also used to derive the prediction block of the current sub-block. These multiple prediction blocks based on multiple motion vectors are combined to generate the final prediction signal of the current sub-block.

[0125] The prediction block based on the motion vectors of neighboring sub-blocks is denoted as P N, where N represents the index for the adjacent upper, lower, left, and right sub-blocks, and the prediction block based on the motion vector of the current sub-block is represented as P C When P N When the motion information contains the same motion information of the neighboring sub-block as the current sub-block, OBMC is not from P N Otherwise, P N Each sample point is added to P C In the same point in the same N Four rows / columns are added to P C The weighting factors {1 / 4, 1 / 8, 1 / 16, 1 / 32} are used for P N , and weighting factors {5 / 16,31 / 32} are used for P C The exception is small MC blocks (i.e. when the height or width of the codec block is equal to 4 or the CU is coded in sub-CU mode), for which only P N Two rows / columns are added to P C In this case, the weighting factors {1 / 4,1 / 8} are used for P N , and weighting factors {3 / 4,7 / 8} are used for P C For P generated based on the motion vectors of vertically (horizontally) adjacent sub-blocks N , P N The samples in the same row (column) of P are added to P with the same weighting factor. C .

[0126] In JEM, for CUs with a size less than or equal to 256 luma samples, a CU level flag is signaled to indicate whether OBMC is applied for the current CU. For CUs with a size greater than 256 luma samples or not encoded in AMVP mode, OBMC is applied by default. At the encoder, when OBMC is applied to a CU, its impact is taken into account during the motion estimation stage. The prediction signal formed by OBMC using the motion information of the upper and left neighboring blocks is used to compensate the upper and left boundaries of the original signal of the current CU, and then the normal motion estimation process is applied.

[0127] 2.5 Example of Local Illumination Compensation (LIC)

[0128] LIC is based on a linear model of illumination variation, using a scaling factor a and an offset b, and is adaptively enabled or disabled for each inter-mode coded codec unit (CU).

[0129] When LIC is applied to a CU, a least square error method is used to derive parameters a and b by using neighboring samples of the current CU and their corresponding reference samples. Fig.13is an example of neighboring sample points used to derive parameters of the IC algorithm. Specifically, and as Fig.13 As shown, the sub-sampled (2:1 sub-sampling) neighboring samples and corresponding samples (identified by the motion information of the current CU or sub-CU) of the reference picture are used. The IC parameters are derived and applied to each prediction direction separately.

[0130] When the CU is encoded and decoded in Merge mode, the LIC flag is copied from the neighboring block in a manner similar to the motion information copying in Merge mode; otherwise, the LIC flag is signaled for the CU to indicate whether LIC is applicable.

[0131] When LIC is enabled for a picture, an additional CU-level RD check is required to determine whether LIC is applied to the CU. When LIC is enabled for a CU, the Mean-Removed Sum of Absolute Difference (MR-SAD) and the Mean-Removed Sum of AbsoluteHadamard-Transformed Difference (MR-SATD) (instead of SAD and SATD) are used for integer pixel motion search and fractional pixel motion search, respectively.

[0132] In order to reduce the coding complexity, the following coding scheme is applied in JEM:

[0133] --When there is no significant illumination change between the current picture and its reference pictures, LIC is disabled for the entire picture. To identify this situation, the histogram of the current picture and each reference picture of the current picture is calculated at the encoder. If the histogram difference between the current picture and each reference picture of the current picture is less than a given threshold, LIC is disabled for the current picture; otherwise, LIC is enabled for the current picture.

[0134] 2.6 Example of Affine Motion Compensated Prediction

[0135] In HEVC, only the translational motion model is applied to Motion Compensation Prediction (MCP). However, cameras and objects may have many kinds of motions, such as zooming in / out, rotation, perspective motion, and / or other irregular motions. On the other hand, JEM applies a simplified affine transformation motion compensation prediction. Fig.14 The motion vector V is shown by two control points 0 and V 1An example of an affine motion field of block 1400 is described. The motion vector field (MVF) of block 1400 can be described by the following equation:

[0136]

[0137] like Fig.14 As shown, is the motion vector of the upper left control point, and (v 1x ,v 1y ) is the motion vector of the upper right control point. To simplify motion compensation prediction, sub-block based affine transformation prediction can be applied. The sub-block size M×N is derived as follows:

[0138]

[0139] Here, MvPre is the fractional precision of the motion vector (e.g., 1 / 16 in JEM), (v 2x ,v 2y ) is the motion vector of the lower left control point calculated according to equation (1). If necessary, M and N can be adjusted downward to be divisors of w and h, respectively.

[0140] Fig.15 An example of an affine MVF for each sub-block of block 1500 is shown. To derive the motion vector for each M×N sub-block, the motion vector of the center sample of each sub-block can be calculated according to equation (1) and rounded to a fractional precision of the motion vector (e.g., 1 / 16 in JEM). Then, a motion compensated interpolation filter can be applied to generate a prediction for each sub-block using the derived motion vector. After MCP, the high-precision motion vector of each sub-block is rounded and saved to the same precision as the normal motion vector.

[0141] 2.6.1 AF_INTER mode implementation

[0142] In JEM, there are two affine motion modes: AF_INTER mode and AF_MERGE mode. For CUs with width and height greater than 8, AF_INTER mode can be applied. The affine flag at the CU level is signaled in the bitstream to indicate whether AF_INTER mode is used. In AF_INTER mode, neighboring blocks are used to construct a pair of motion vectors {(v 0 ,v 1 )|v 0 = {v A ,v B ,v c},v 1 = {v D ,v E}}'s candidate list.

[0143] Fig.16 An example of motion vector prediction (MVP) of block 1600 in AF_INTER mode is shown. Fig.16 As shown, v is selected from the motion vector of sub-block A, block B or block C. 0 The motion vector from the neighboring block can be scaled according to the reference list. The motion vector can also be scaled according to the relationship between the picture order count (POC) of the reference of the neighboring block, the POC of the reference of the current CU, and the POC of the current CU. And v is selected from the neighboring sub-blocks D and E. 1 The method is similar. If the number of candidate lists is less than 2, the list is filled with motion vector pairs formed by copying each AMVP candidate. When the candidate list is greater than 2, the candidates can be first sorted according to neighboring motion vectors (for example, based on the similarity of the two motion vectors in a pair of candidates). In some embodiments, the first two candidates are retained. In some embodiments, a rate-distortion (RD) cost check is used to determine which motion vector pair candidate is selected as the control point motion vector prediction (CPMVP) of the current CU. An index indicating the position of the CPMVP in the candidate list can be signaled in the bitstream. After determining the CPMVP of the current affine CU, affine motion estimation is applied and the control point motion vector (CPMV) is found. Then, the difference between the CPMV and the CPMVP is signaled in the bitstream.

[0144] 2.6.3. AF_MERGE mode implementation

[0145] When a CU is applied in AF_MERGE mode, it gets the first block coded in affine mode from the valid neighboring reconstructed blocks. Fig.17A An example of the selection order of candidate blocks of the current CU 1700 is shown. Fig.17A As shown, the selection order may be from the left side ( 1701 ), the upper side ( 1702 ), the upper right side ( 1703 ), the lower left side ( 1704 ) to the upper left side ( 1705 ) of the current CU 1700 . Fig. 17B Another example of candidate blocks of the current CU 1700 in AF_MERGE mode is shown. If the adjacent lower left block 1801 is encoded and decoded in affine mode, such as Fig. 17B As shown, the motion vectors v of the upper left corner, upper right corner and lower left corner of the CU containing sub-block 1701 are 2 、v 3 and v 4The motion vector v of the upper left corner of the current CU 1700 is calculated based on v2, v3 and v4. 0 . The motion vector v1 of the upper right corner of the current CU can be calculated accordingly.

[0146] After calculating the CPMV v0 and v1 of the current CU according to the affine motion model in equation (1), the MVF of the current CU can be generated. In order to identify whether the current CU is encoded or decoded in AF_MERGE mode, when at least one neighboring block is encoded or decoded in affine mode, an affine flag is signaled in the bitstream.

[0147] 2.7 Example of Pattern Matched Motion Vector Derivation (PMMVD)

[0148] The PMMVD mode is a special Merge mode based on the Frame Rate Up Conversion (FRUC) method. In this mode, the motion information of the block is derived at the decoder side instead of signaling the motion information of the block.

[0149] When the Merge flag of the CU is true, the FRUC flag can be signaled for the CU. When the FRUC flag is false, the Merge index can be signaled and the normal Merge mode is used. When the FRUC flag is true, an additional FRUC mode flag can be signaled to indicate which method (e.g., bilateral matching or template matching) will be used to derive the motion information of the block.

[0150] On the encoder side, the decision on whether to use the FRUC Merge mode for a CU is based on the RD cost selection made for the normal Merge candidate. For example, multiple matching modes (e.g., bilateral matching and template matching) are checked for the CU by using the RD cost selection. The matching mode that causes the minimum cost is further compared with other CU modes. If the FRUC matching mode is the most effective mode, the FRUC flag is set to true for the CU and the relevant matching mode is used.

[0151] Generally, the motion derivation process in FRUC Merge mode has two steps: first, a CU-level motion search is performed, and then sub-CU-level motion refinement is performed. At the CU level, the initial motion vector of the entire CU is derived based on bilateral matching or template matching. First, a list of MV candidates is generated, and the candidate that causes the minimum matching cost is selected as the starting point for further CU-level refinement. Then, a local search based on bilateral matching or template matching is performed near the starting point. The MV result of the minimum matching cost is used as the MV of the entire CU. Subsequently, the motion information is further refined at the sub-CU level using the derived CU motion vector as the starting point.

[0152] For example, the following derivation process is performed for W×HCU motion information derivation. In the first stage, the MV of the entire W×HCU is derived. In the second stage, the CU is further divided into M×M sub-CUs. The value of M is calculated as in equation (3), where D is the predefined partition depth, which is set to 3 by default in JEM. Then the MV of each sub-CU is derived.

[0153]

[0154] Fig.18 An example of bilateral matching used in a frame rate up conversion (FRUC) method is shown. Bilateral matching is used to derive motion information of the current CU by finding the closest match between two blocks along the motion trajectory of the current CU (1800) in two different reference pictures (1810, 1811). Under the assumption of a continuous motion trajectory, the motion vectors MV0 (1801) and MV1 (1802) pointing to the two reference blocks are proportional to the temporal distance (e.g., TD0 (1803) and TD1 (1804)) between the current picture and the two reference pictures. In some embodiments, when the current picture 1800 is between the two reference pictures (1810, 1811) in the temporal domain and the temporal distance from the current picture to the two reference pictures is the same, the bilateral matching becomes a mirror-based bidirectional MV.

[0155] Fig.19 An example of template matching used in a frame rate up conversion (FRUC) method is shown. Template matching can be used to derive motion information of the current CU 1900 by finding the closest match between a template in the current picture (e.g., the top and / or left neighboring blocks of the current CU) and a block in the reference picture 1910 (the same size as the template). In addition to the above-mentioned FRUC Merge mode, template matching can also be applied to the AMVP mode. In JEM and HEVC, AMVP has two candidates. Using the template matching method, a new candidate can be derived. If the candidate newly derived by template matching is different from the first existing AMVP candidate, it is inserted at the very beginning of the AMVP candidate list, and then the list size is set to 2 (e.g., by removing the second existing AMVP candidate). When applied to the AMVP mode, only CU-level search is applied. The CU-level MV candidate set can include the following: (1) the original AMVP candidate if the current CU is in AMVP mode, (2) all Merge candidates, (3) several MVs in the interpolated MV field (described later), and the top and left neighboring motion vectors.

[0156] When bilateral matching is used, each valid MV of the Merge candidate is used as input to generate an MV pair assuming bilateral matching. For example, in reference list A, one valid MV of the Merge candidate is (MVa, refa). Then, find the reference picture refb of its paired bilateral MV in other reference list B, so that refa and refb are on different sides of the current picture in the temporal domain. If such refb is not available in reference list B, refb is determined to be a reference different from refa, and its temporal distance to the current picture is the minimum in list B. After determining refb, MVb is derived by scaling MVa based on the temporal distance between the current picture refa and refb.

[0157] In some embodiments, four MVs from the interpolated MV field may also be added to the CU level candidate list. More specifically, the interpolated MVs at positions (0,0), (W / 2,0), (0,H / 2), and (W / 2,H / 2) of the current CU are added. When FRUC is applied in AMVP mode, the original AMVP candidate is also added to the CU level MV candidate set. In some embodiments, at the CU level, 15 MVs may be added to the candidate list for the AMVP CU, and 13 MVs may be added to the candidate list for the Merge CU.

[0158] The MV candidate set at the sub-CU level includes: (1) MVs determined from the CU level search, (2) top, left, upper left, and upper right neighboring MVs, (3) scaled versions of collocated MVs from reference pictures, (4) one or more ATMVP candidates (e.g., up to four), and (5) one or more STMVP candidates (e.g., up to four). The scaled MVs from the reference picture are derived as follows. The reference pictures in the two lists are traversed. The MV at the collocated position of the sub-CU in the reference picture is scaled to the reference of the starting CU level MV. The ATMVP and STMVP candidates can be the first four. At the sub-CU level, one or more MVs (e.g., up to 17) are added to the candidate list.

[0159] Generation of interpolated MV fields. Before encoding and decoding the frame, an interpolated motion field is generated for the entire picture based on single-sided ME. The motion field can then be used as a CU-level or sub-CU-level MV candidate later.

[0160] In some embodiments, the motion field of each reference picture in the two reference lists is traversed at a 4×4 block level. Fig. 20An example of a single-sided motion estimation (ME) 2000 in the FRUC method is shown. For each 4×4 block, if the motion associated with the block passes through a 4×4 block in the current picture and the block is not assigned any interpolated motion, the motion of the reference block is scaled to the current picture according to the temporal distances TD0 and TD1 (in the same way as the MV scaling of TMVP in HEVC), and the scaled motion is assigned to the block in the current frame. If no scaled MV is assigned to the 4×4 block, the motion of the block is marked as unavailable in the interpolated motion field.

[0161] Interpolation and matching costs. When the motion vector points to a fractional sample position, motion compensated interpolation is required. To reduce complexity, bilinear interpolation can be used for bilateral matching and template matching instead of conventional 8-tap HEVC interpolation.

[0162] The calculation of the matching cost is a little different at different steps. When selecting candidates from the candidate set at the CU level, the matching cost can be the absolute sum difference (SAD) of bilateral matching or template matching. After determining the starting MV, the matching cost C of the bilateral matching of the sub-CU level search is calculated as follows:

[0163]

[0164] Here, w is a weighting factor. In some embodiments, w can be empirically set to 4. MV and MV s Indicates the current MV and the starting MV respectively. SAD can still be used as the matching cost of template matching for sub-CU level search.

[0165] In FRUC mode, MV is derived by using luma samples only. The derived motion will be used for both luma and chroma for MC inter prediction. After determining MV, final MC is performed using 8-tap interpolation filter for luma and 4-tap interpolation filter for chroma.

[0166] MV refinement is a pattern-based MV search with bilateral matching cost or template matching cost as the criterion. In JEM, two search modes are supported - Unrestricted Center-Biased Diamond Search (UCBDS) and Adaptive Cross Search, which perform MV refinement at CU level and sub-CU level, respectively. For both CU and sub-CU level MV refinement, MV is directly searched with quarter luma sample MV precision, and followed by one-eighth luma sample MV refinement. The search range for MV refinement for CU and sub-CU steps is set equal to 8 luma samples.

[0167] In bilateral matching Merge mode, bidirectional prediction is applied because the motion information of the CU is derived based on the closest match between two blocks along the motion trajectory of the current CU in two different reference pictures. In template matching Merge mode, the encoder can choose between unidirectional prediction according to list 0, unidirectional prediction according to list 1, or bidirectional prediction for the CU. The selection can be based on the template matching cost as follows:

[0168] If costBi <= factor * min (cost0, cost1)

[0169] Bidirectional prediction is used;

[0170] Otherwise, if cost0 <= cost1

[0171] Then use the one-way prediction in list 0;

[0172] otherwise,

[0173] Use the one-way prediction in Listing 1;

[0174] Here, cost0 is the SAD of list 0 template matching, cost1 is the SAD of list 1 template matching, and costBi is the SAD of bi-prediction template matching. For example, when the value of factor is equal to 1.25, it means that the selection process is biased towards bi-prediction. Inter prediction direction selection can be applied to the CU level template matching process.

[0175] 2.8 Example of Generalized Bidirectional Prediction Improvement (GBi)

[0176] VTM-3.0 adopts the generalized bidirectional prediction improvement (GBi) proposed in JVET-L0646. In bidirectional prediction mode, GBi applies unequal weights to the prediction values ​​from L0 and L1. In inter-frame prediction mode, multiple weight pairs including equal weight pairs (1 / 2, 1 / 2) are evaluated based on rate-distortion optimization (RDO), and the GBi index of the selected weight pair is signaled to the decoder. In Merge mode, the GBi index is inherited from the neighboring CU. The prediction value generation formula is shown in equation (5).

[0177] P GBi =(w0×P L0 +w1×P L1 +RoundingOffset)>>shiftNum GBi Equation (5)

[0178] In this article, P GBi is the final predicted value of GBi, w0 and w 1 are the predicted values ​​(P L0 and P L1 ) of the selected GBi weight. RoundingOffset GBi and shiftNum GBi Used to normalize the final prediction value in GBi. Supported w 1 The weight set is {-1 / 4, 3 / 8, 1 / 2, 5 / 8, 5 / 4}, where the five weights correspond to one equal weight pair and four unequal weight pairs. The mixed gain, i.e., w 1 and w 0 The sum of is fixed to 1.0. Therefore, the corresponding w 0 The weight set is {5 / 4, 5 / 8, 1 / 2, 3 / 8, -1 / 4}. The weight pairs are selected at the CU level.

[0179] For non-low-latency images, the weight set size is reduced from 5 to 3, where w 1 The weight set is {3 / 8, 1 / 2, 5 / 8}, and w 0 The weight set is {5 / 8, 1 / 2, 3 / 8}. The weight set size reduction for non-low-latency images is applied to BMS2.1 GBi and all GBi tests in this manuscript.

[0180] 2.8.1 GBi encoder bug fixes

[0181] In order to reduce GBi encoding time, in the current encoder design, the encoder will store the unidirectional prediction motion vector estimated from the GBi weight equal to 4 / 8 and reuse it for unidirectional prediction search for other GBi weights. This fast encoding method is applied to translational motion models and affine motion models. In VTM2.0, a 6-parameter affine model as well as a 4-parameter affine model are adopted. When the GBi weight is equal to 4 / 8, the BMS2.1 encoder does not distinguish between the 4-parameter affine model and the 6-parameter affine model when storing the unidirectional prediction affine MV. Therefore, after encoding with GBi weight 4 / 8, the 4-parameter affine MV can be overwritten by the 6-parameter affine MV. The stored 6-parameter affine MV can be used for the 4-parameter affine MV of other GBi weights, or the stored 4-parameter affine MV can be used for the 6-parameter affine MV. The proposed GBi encoder error fix is ​​to separate the 4-parameter and 6-parameter affine MV storage. When the GBi weight is equal to 4 / 8, the encoder stores those affine MVs based on the affine model type and reuses the corresponding affine MVs based on the affine model type for other GBi weights.

[0182] 2.8.2 GBi encoder acceleration

[0183] In this existing implementation, five encoder acceleration methods are proposed to reduce encoding time when GBi is enabled.

[0184] (1) Conditionally skip affine motion estimation for some GBi weights

[0185] In BMS2.1, affine ME including 4-parameter and 6-parameter affine ME is performed on all GBi weights. It is proposed to conditionally skip affine ME for those unequal GBi weights (weights not equal to 4 / 8). Specifically, affine ME will be performed on other GBi weights if and only if affine mode is selected as the current best mode and it is not affine Merge mode after evaluating 4 / 8 of GBi weights. If the current picture is a non-low-latency picture, when affine motion estimation is performed, the bidirectional prediction motion estimation of the translation model will be skipped for unequal GBi weights. If the affine mode is not selected as the current best mode, or if affine Merge is selected as the current best mode, affine ME will be skipped for all other GBi weights.

[0186] (2) Reduce the number of weights used for RD cost checks for low-latency images in 1-pixel and 4-pixel MVD precision encoding

[0187] For low-latency pictures, there are five weights for RD cost checks of all MVD precisions including 1 / 4 pixel, 1 pixel, and 4 pixel. The encoder will first check the RD cost of 1 / 4 pixel MVD precision. It is proposed to skip a part of the GBi weights for RD cost checks of 1 pixel and 4 pixel MVD precision. The unequal weights are sorted according to the RD cost of 1 / 4 pixel MVD precision of those unequal weights. During encoding of 1 pixel and 4 pixel MVD precision, only the first two weights with the smallest RD cost and the GBi weight 4 / 8 will be evaluated. Therefore, for 1 pixel and 4 pixel MVD precision of low-latency pictures, a maximum of three weights will be evaluated.

[0188] (3) When the L0 and L1 reference pictures are the same, conditionally skip the bidirectional prediction search

[0189] For some pictures in RA, the same picture may appear in both reference picture lists (list 0 and list 1). For example, for the random access codec configuration in CTC, the reference picture structure of the first group of pictures (GOP) is listed as follows.

[0190] POC:16,TL:0,[L0: 0 ][L1: 0 ]

[0191] POC:8,TL:1,[L0: 0 16 ][L1:16 0 ]

[0192] POC:4,TL:2,[L0:0 8 ][L1: 8 16]

[0193] POC:2,TL:3,[L0:0 4 ][L1: 4 8]

[0194] POC:1,TL:4,[L0:0 2 ][L1: 2 4]

[0195] POC:3,TL:4,[L0:2 0][L1:4 8]

[0196] POC:6,TL:3,[L0:4 0][L1:8 16]

[0197] POC:5,TL:4,[L0:4 0][L1:6 8]

[0198] POC:7,TL:4,[L0:6 4][L1:8 16]

[0199] POC:12,TL:2,[L0: 8 0][L1:16 8 ]

[0200] POC:10,TL:3,[L0:8 0][L1:12 16]

[0201] POC:9,TL:4,[L0:8 0][L1:10 12]

[0202] POC:11,TL:4,[L0:10 8][L1:12 16]

[0203] POC:14,TL:3,[L0: 12 8][L1: 12 16]

[0204] POC:13,TL:4,[L0:12 8][L1:14 16]

[0205] POC:15,TL:4,[L0: 14 12][L1:16 14 ]

[0206] Note that pictures 16, 8, 4, 2, 1, 12, 14, and 15 have the same reference picture(s) in both lists. For bidirectional prediction of these pictures, the L0 and L1 reference pictures may be the same. We propose that the encoder skips bidirectional prediction ME for unequal GBi weights when 1) the two reference pictures in the bidirectional prediction are the same, and 2) the temporal layer is greater than 1, and 3) the MVD precision is 1 / 4 pixel. For affine bidirectional prediction ME, this fast skip method is only applied to 4-parameter affine ME.

[0207] (4) Based on the temporal layer and the POC distance between the reference picture and the current picture, skip the RD cost check for unequal GBi weights

[0208] It is proposed to skip those RD cost evaluations for those unequal GBi weights when the temporal layer is equal to 4 (the highest temporal layer in RA) or the POC distance between the reference picture (list 0 or list 1) and the current picture is equal to 1 and the codec QP is greater than 32.

[0209] (5) During ME, for unequal GBi, change floating point calculations to fixed point calculations

[0210] For existing bi-directional prediction search, the encoder will fix the MV of one list and refine the MV in the other list. The target is modified before ME to reduce computational complexity. For example, if the MV of list 1 is fixed and the encoder wants to refine the MV of list 0, the target of list 0 MV refinement is modified by equation (6). O is the original signal, and P 1 is the prediction signal of list 1. w is the GBi weight of list 1.

[0211] T=((O<<3)-w*P 1 )*(1 / (8-w)) Equation (6)

[0212] In this paper, the term (1 / (8-w)) is stored in floating point precision, which increases the computational complexity. It is proposed to change equation (6) to fixed point as in equation (7).

[0213] T=(O*a 1 -P 1 *a 2 +round)>>N Equation (7)

[0214] where a 1 and a 2 are scaling factors, and they are calculated as follows:

[0215] γ=(1<<N) / (8-w);a 1 =γ<<3; a 2=γ*w; round=1<<(N-1)

[0216] 2.8.3 GBi CU Size Constraints

[0217] In this method, GBi is disabled for small CUs. In inter prediction mode, if bidirectional prediction is used and the CU area is smaller than 128 luma samples, GBi is disabled without any signaling.

[0218] 2.9 Example of Bidirectional Optical Flow (BDOF or BIO)

[0219] 2.9.1 Overview of BDOF

[0220] In BIO, motion compensation is first performed to generate a first prediction of the current block (in each prediction direction). The first prediction is used to derive the spatial gradient, temporal gradient, and optical flow of each sub-block or pixel within the block, which is then used to generate a second prediction, such as the final prediction of the sub-block or pixel. The details are described below.

[0221] The Bidirectional Optical Flow (BIO) method is a sample-by-sample motion refinement performed on the basis of block-by-block motion compensation of bidirectional prediction. In some embodiments, the sample-level motion refinement does not use signaling.

[0222] Hypothesis I (k) is the luminance value from reference k (k=0,1) after block motion compensation, and and Represented as I (k) The horizontal and vertical components of the gradient. Assuming that optical flow is valid, the motion vector field (v x ,v y ) is given by:

[0223]

[0224] Combining this optical flow equation with the Hermite interpolation of the motion trajectory for each sample point ultimately produces the function value I (k) And the derivative and The only third-order polynomial that matches. When t=0, the value of this polynomial is the BIO prediction:

[0225]

[0226] Fig.24 shows an example optical flow trajectory in the bidirectional optical flow (BIO) method. Here, τ 0 and τ 1 Represents the distance to the reference frame. Distance τ 0 and τ 1 Based on Ref0 and Ref 1 The POC is calculated as: τ 0 =POC(Current)-POC(Ref 0 ), τ 1 =POC(Ref 1 )-POC(current). If the two predictions are from the same time direction (both from the past or both from the future), then the signs are different (e.g., τ 0 ·τ 1 < 0). In this case, if the predictions are not from the same moment (e.g., τ 0 ≠τ 1 ). The two reference regions have non-zero motion (e.g., MVx 0 , MVy 0 , MVx 1 , MVy 1 ≠0), and the block motion vector is proportional to the temporal distance (e.g., MVx 0 / MVx 1 =MVy 0 / MVy 1 =-τ 0 / τ 1 ).

[0227] The motion vector field (vx, vy) is determined by minimizing the difference Δ between the values ​​in points A and B. Fig.21 An example of the intersection of the motion trajectory and the reference frame plane is shown. The model uses only the first linear term of the local Taylor expansion of Δ:

[0228]

[0229] All values ​​in the above equations depend on the sample point location, denoted as (i′, j′). Assuming that the motion is consistent in the local surrounding area, it can be minimized inside a (2M+1)×(2M+1) square window Ω centered at the current prediction point (i, j), where M is equal to 2:

[0230]

[0231] For this optimization problem, JEM uses a simplified approach, first minimizing in the vertical direction and then minimizing in the horizontal direction. This leads to the following:

[0232]

[0233]

[0234] in,

[0235]

[0236] To avoid division by zero or by very small values, regularization parameters r and m can be introduced in Equations (12) and (13), where:

[0237] r=500·4 d-8 Equation (15)

[0238] m=700·4 d-8 Equation (16)

[0239] Here, d is the bit depth of the video samples.

[0240] In order to keep the memory access to BIO the same as for regular bi-predictive motion compensation, all predictions and gradient values ​​I (k) , It is calculated for the position inside the current block. Fig.22A An example of an access location outside of block 2200 is shown. Fig.22A As shown in equation (12), a (2m+1)×(2m+1) square window Ω centered at the current prediction point on the boundary of the prediction block needs to access the location outside the block. In JEM, the value I outside the block (k) , is set equal to the nearest available value inside the block. For example, this can be implemented as filling area 2201, such as Fig. 22B shown.

[0241] With BIO, it is possible to refine the motion field for each sample. To reduce computational complexity, a block-based design of BIO is used in JEM. Motion refinement can be computed based on 4×4 blocks. In block-based BIO, s in equation (12) can be aggregated for all samples in a 4×4 block. n The value of s n The aggregate value of is used for the derivation of BIO motion vector offsets for 4×4 blocks. More specifically, the following formula can be used for block-based BIO derivation:

[0242]

[0243] Here, b k represents the set of samples belonging to the kth 4×4 block of the prediction block. n Replaced by ((s n,bk )>>4) to derive the associated motion vector offset.

[0244] In some scenes, the MV refinement of BIO may be unreliable due to noise or irregular motion. Therefore, in BIO, the amplitude of MV refinement is clipped to a threshold. The threshold is determined based on whether the reference pictures of the current picture are all from one direction. For example, if all the reference pictures of the current picture are from one direction, the value of the threshold is set to 12×2 14-d ; otherwise, it is set to 12×2 13-d .

[0245] The gradient of the BIO may be simultaneously calculated using motion compensated interpolation using operations consistent with the HEVC motion compensation process (e.g., a 2D separable finite impulse response (FIR)). In some embodiments, the input to the 2D separable FIR is the same reference frame samples as the motion compensation process and the fractional positions (fracX, fracY) according to the fractional part of the block motion vector. For the horizontal gradient , the signal is first interpolated vertically using BIOfilterS corresponding to fractional position fracY with a descaling shift of d-8. Then a gradient filter BIOfilterG is applied in the horizontal direction corresponding to fractional position fracX with a descaling shift of 18-d. For the vertical gradient , a gradient filter is applied vertically using BIOfilterG corresponding to the fractional position fracY with a descaling shift of d-8. Then a signal displacement is performed using BIOfilterS in the horizontal direction corresponding to the fractional position fracX with a descaling shift of 18-d. The length of the interpolation filter BIOfilterG used for gradient calculation and the interpolation filter BIOfilterF used for signal displacement can be shorter (e.g., 6 taps) in order to maintain a reasonable complexity. Table 1 shows example filters that can be used for gradient calculation of different fractional positions of block motion vectors in BIO. Table 2 shows example interpolation filters that can be used for prediction signal generation in BIO.

[0246] Table 1: Exemplary filters for gradient calculation in BIO

[0247] Fractional precision position Gradient interpolation filter (BIOfilterG) 0 {8,-39,-3,46,-17,5} 1 / 16 {8,-32,-13,50,-18,5} 1 / 8 {7,-27,-20,54,-19,5} 3 / 16 {6,-21,-29,57,-18,5} 1 / 4 {4,-17,-36,60,-15,4} 5 / 16 {3,-9,-44,61,-15,4} 3 / 8 {1,-4,-48,61,-13,3} 7 / 16 {0,1,-54,60,-9,2} 1 / 2 {-1,4,-57,57,-4,1}

[0248] Table 2: Exemplary interpolation filters for prediction signal generation in BIO

[0249] Fractional precision position Interpolation filter for prediction signal (BIOfilterS) 0 {0,0,64,0,0,0} 1 / 16 {1,-3,64,4,-2,0} 1 / 8 {1,-6,62,9,-3,1} 3 / 16 {2,-8,60,14,-5,1} 1 / 4 {2,-9,57,19,-7,2} 5 / 16 {3,-10,53,24,-8,2} 3 / 8 {3,-11,50,29,-9,2} 7 / 16 {3,-11,44,35,-10,3} 1 / 2 {3,-10,35,44,-11,3}

[0250] In JEM, BIO can be applied to all bidirectionally predicted blocks when the two predictions come from different reference pictures. BIO can be disabled when Local Illumination Compensation (LIC) is enabled for a CU.

[0251] In some embodiments, OBMC is applied to a block after a normal MC process. In order to reduce computational complexity, BIO may not be applied during the OBMC process. This means that BIO is applied to the MC process of a block when using the block's own MV, but not applied to the MC process when using the MV of a neighboring block during the OBMC process.

[0252] 2.9.2 Example of BIO in VTM-3.0 as proposed in JVET-L0256

[0253] Step 1 : Determine whether BIO is applicable (W / H is the width / height of the current block)

[0254] BIO does not apply if:

[0255] o The current video block is affine coded or ATMVP coded

[0256] ο(iPOC-iPOC 0 )×(iPOC-iPOC 1 )≥0

[0257] oH==4 or (W==4 and H==8)

[0258] οWith weighted prediction

[0259] οGBi weight is not (1, 1)

[0260] If two reference blocks (denoted as R 0 and R 1 ) is less than the threshold, then BIO is not used.

[0261]

[0262] Step 2 : Data preparation

[0263] For a WxH block, (W+2)x(H+2) samples are interpolated.

[0264] As in normal motion compensation, the internal WxH samples are interpolated using an 8-tap interpolation filter.

[0265] The four outer lines of the sample point ( Fig.23 The black circles in the figure are interpolated using a bidirectional linear filter.

[0266] For each position, in two reference blocks (R 0 and R 1 ) to calculate the gradient.

[0267] Gx0(x,y)=(R0(x+1,y)-R0(x-1,y))>>4

[0268] Gy0(x,y)=(R0(x,y+1)-R0(x,y-1))>>4

[0269] Gx1(x,y)=(R1(x+1,y)-R1(x-1,y))>>4

[0270] Gy1(x,y)=(R1(x,y+1)-R1(x,y-1))>>4

[0271] For each position, the internal value is calculated as:

[0272] T1=(R0(x,y)>>6)-(R1(x,y)>>6), T2=(Gx0(x,y)+Gx1(x,y))>>3, T3=(Gy0(x,y)+Gy1(x,y))>>3; and

[0273] B1(x,y)=T2*T2, B2(x,y)=T2*T3, B3(x,y)=-T1*T2, B5(x,y)=T3*T3, B6(x,y)=-T1*T3

[0274] Step 3 : Compute the prediction for each block

[0275] If the SAD between two 4x4 reference blocks is less than a threshold, the BIO is skipped for the 4x4 block.

[0276] Calculate Vx and Vy.

[0277] Compute the final prediction for each position in the 4×4 block:

[0278] b(x,y)=(Vx(Gx 0 (x,y)-Gx 1 (x,y))+Vy(Gy 0 (x,y)-Gy 1 (x,y))+1)>>1

[0279] P(x,y)=(R 0 (x,y)+R 1 (x,y)+b(x,y)+offset)>>shift

[0280] In this paper, b(x, y) is called the correction term.

[0281] 2.9.3BIO in VTM-4.0

[0282] In VTM-4.0, JVET-M0063, which proposed rounding the calculation results in BDOF according to the bit depth, is adopted.

[0283] In VTM-4.0, JVET-M0487 is adopted, which removes the bilinear filtering and extracts the nearest integer pixels of the reference block to fill the four outer lines of samples ( Fig.23 black circle in the figure).

[0284] The BIO-related working draft in VTM-4.0 is shown below (from JVET-M1001)

[0285] 2.9.4 Fractional Sample Interpolation Process

[0286] General

[0287] The inputs to this process are:

[0288] - Luma position (xSb, ySb), specifies the upper left sample of the current codec subblock relative to the upper left luminance sample of the current picture,

[0289] -Variable sbWidth, specifies the width of the current codec sub-block,

[0290] -Variable sbHeight, specifies the height of the current codec sub-block,

[0291] - motion vector offset mvOffset,

[0292] - the refined motion vector refMvLX,

[0293] - the selected reference picture sample array refPicLX,

[0294] - bidirectional optical flow flag bdofFlag,

[0295] -Variable cIdx specifies the color component index of the current block.

[0296] The output of this process is:

[0297] - predSamplesLX, an array of (sbWidth+bdofOffset)x(sbHeight+bdofOffset) predicted sample values.

[0298] The bidirectional optical flow boundary offset bdofOffset is derived as follows:

[0299] bdofOffset=bdofFlag? 2:0 (8-811) - If cIdx is equal to 0, the following applies:

[0300] - Assume that (xIntL, yIntL) is the luma position given in full sample units, and (xFracL, yFracL) is the offset given in 1 / 16 sample units. These variables are used only in this clause,

[0301] It is used to specify the fractional sample position within the reference sample array refPicLX.

[0302] -For each luma sample position (x L =0..sbWidth-1+bdofOffset,y L =0..sbHeight-1+bdofOffset), the corresponding predicted brightness sample value predSamplesLX[x L ][y L ] is derived as follows:

[0303] -Variable xInt L ,yInt L 、xFrac L and yFrac L is derived as follows:

[0304] xInt L =xSb+(refMvLX[0]>>4)+x L (8-812)

[0305] yInt L =ySb+(refMvLX[1]>>4)+y L (8-813)

[0306] xFrac L =refMvLX[0]&15 (8-814)

[0307] yFrac L =refMvLX[1]&15 (8-815)

[0308] - If bdofFlag is equal to TRUE, and one or more of the following conditions are true, the predicted luma sample values ​​predSamplesLX[x L ][y L ] By calling the clause

[0309] The luminance integer sample extraction process specified in 8.5.7.3.3 is derived with (xInt L ,yInt L ),

[0310] (xFracL ,yFrac L ) and refPicLX are output:

[0311] -bdofFlag is equal to TRUE.

[0312] -x L is equal to 0.

[0313] -x L Equal to sbWidth+1.

[0314] -y L is equal to 0.

[0315] -y L Equal to sbHeight+1.

[0316] - Otherwise, the following applies:

[0317] -The motion vector mvLX is set to (refMvLX-mvOffset).

[0318] The predicted luma sample values ​​predSamplesLX[xL][yL] are derived by invoking the luma sample 8-tap interpolation filter process as specified in clause 8.5.7.3.2, with (xIntL, yIntL), (xFracL, yFracL), refPicLX and padVal as input.

[0319] …

[0320] Luminance integer sample extraction process

[0321] The inputs to this process are:

[0322] - Luma position in full sample units (xInt L ,yInt L ),

[0323] - Luminance reference sample array refPicLX L ,

[0324] The output of this process is the predicted luminance sample value predSampleLX L

[0325] The variable shift is set to Max(2,14-BitDepth Y ).

[0326] The variable picW is set equal to pic_width_in_luma_samples, and the variable picH is set equal to pic_height_in_luma_samples.

[0327] The luma position (xInt, YnT) of the full sampling unit is derived as follows:

[0328] xInt=Clip3(0,picW–1,sps_ref_wraparound_enabled_flag? (8-838)

[0329] ClipH((sps_ref_wraparound_offset_minus1+1)*MinCbSizeY,picW,xInt L ):xInt L )

[0330] yInt=Clip3(0,picH-1,yInt L ) (8-839)

[0331] Predicted brightness sample value predSampleLX L is derived as follows:

[0332] predSampleLX L =refPicLX L [xInt][yInt]< <shift3 (8-840)

[0333] Bidirectional optical flow prediction process

[0334] The inputs to this process are:

[0335] - Two variables nCbW and nCbH, specifying the width and height of the current codec block,

[0336] - two (nCbW+2)x(nCbH+2) arrays of luma prediction samples predSamplesL0 and predSamplesL1,

[0337] - The prediction list uses the flags predFlagL0 and predFlagL1,

[0338] - reference indices refIdxL0 and refIdxL1,

[0339] - Bidirectional optical flow utilization flag bdofUtilizationFlag[xIdx][yIdx], where xIdx=0..(nCbW>>2)–1, yIdx=0..(nCbH>>2)-1.

[0340] The output of this process is a (nCbW)x(nCbH) array pbSamples of luma prediction sample values.

[0341] The variables bitDepth, shift1, shift2, shift3, shift4, offset4, and mvRefineThres are derived as follows:

[0342] -The variable bitDepth is set equal to BitDepth Y .

[0343] -The variable shift1 is set equal to Max(2,14-bitDepth).

[0344] -The variable shift2 is set equal to Max(8,bitDepth-4).

[0345] -The variable shift3 is set equal to Max(5,bitDepth-7).

[0346] -The variable shift4 is set equal to Max(3,15-bitDepth), and the variable offset4 is set equal to 1<<(shift4-1).

[0347] -The variable mvRefineThres is set equal to Max(2,1<<(13-bitDepth)).

[0348] For xIdx = 0..(nCbW>>2)–1 and yIdx = 0..(nCbH>>2)-1, the following applies:

[0349] -The variable xSb is set equal to (xIdx<<2)+1, and ySb is set equal to (yIdx<<2)+1.

[0350] - If bdofUtilizationFlag[xSbIdx][yIdx] is equal to FALSE, then for x=xSb-1..xSb+2, y=ySb-1..ySb+2, the predicted sample values ​​of the current sub-block are derived

[0351] as follows:

[0352] pbSamples[x][y]=Clip3(0,(2 bitDepth )-1,

[0353] (predSamplesL0[x+1][y+1]+offset2+predSamplesL1[x+1][y+1])>>

[0354] shift2) (8-852)

[0355] - Otherwise (bdofUtilizationFlag[xSbIdx][yIdx] is equal to TRUE), the prediction of the current sub-block

[0356] The sample point values ​​are derived as follows:

[0357] - For x = xSb-1..xSb+4, y = ySb-1..ySb+4, the following sequential steps apply:

[0358] 1. Predict the position (h) of each corresponding sample point position (x, y) inside the sample point array x ,v y ) is derived as follows:

[0359] h x =Clip3(1,nCbW,x) (8-853)

[0360] v y =Clip3(1,nCbH,y) (8-854)

[0361] 2. Variables gradientHL0[x][y], gradientVL0[x][y],

[0362] gradientHL1[x][y] and gradientVL1[x][y] are derived as follows:

[0363] gradientHL0[x][y]=(predSamplesL0[h x +1][v y ]-predSampleL0[h x -1][v y ])>>shift1 (8-855)

[0364] gradientVL0[x][y]=(predSampleL0[h x ][v y +1]-predSampleL0[h x ][v y -1])>>shift1 (8-856)

[0365] gradientHL1[x][y]=(predSamplesL1[h x +1][v y ]-predSampleL1[h x -1][v y ])>>shift1 (8-857)

[0366] gradientVL1[x][y]=(predSampleL1[h x ][v y +1]-predSampleL1[h x ][v y -1])>>shift1 (8-858)

[0367] 3. The variables temp[x][y], tempH[x][y], and tempV[x][y] are derived as follows:

[0368] diff[x][y]=(predSamplesL0[h x ][v y ]>>shift2)-(predSamplesL1[h x ][v y ]>>shift2) (8-859)

[0369] tempH[x][y]=(gradientHL0[x][y]+gradientHL1[x][y])>>shift3

[0370] (8-860)

[0371] tempV[x][y]=(gradientVL0[x][y]+gradientVL1[x][y])>>shift3

[0372] (8-861)

[0373] - The variables sGx2, sGy2, sGxGy, sGxdI and sGydI are derived as follows:

[0374] sGx2=∑ i ∑ j (tempH[xSb+i][ySb+j]*tempH[xSb+i][ySb+j]), where i,j=-1..4(8-862)

[0375] sGy2=∑ i ∑ j (tempV[xSb+i][ySb+j]*tempV[xSb+i][ySb+j]), where i,j=-1..4(8-863)

[0376] sGxGy=∑ i ∑ j(tempH[xSb+i][ySb+j]*tempV[xSb+i][ySb+j]), where i,j-1..4(8-864)

[0377] sGxdI=∑ i ∑ j (-tempH[xSb+i][ySb+j]*diff[xSb+i][ySb+j]), where i,j=-1..4(8-865)

[0378] sGydI=∑ i ∑ j (-tempV[xSb+i][ySb+j]*diff[xSb+i][ySb+j]), where i,j = -1..4 (8-866) - the horizontal and vertical motion offsets of the current sub-block are derived as follows:

[0379] v x =sGx2>0? Clip3(-mvRefineThres,mvRefineThres,-(sGxdI<<3)>>Floor(Log2(sGx2))):0 (8-867)

[0380] v y =sGy2>0? Clip3(-mvRefineThres,mvRefineThres,((sGydI<<3)-((v x *Sx m )<<12+v x *Sx s )>>1)>>Floor(Log2(sGx2))):0 (8-868)

[0381] - For x = xSb-1..xSb+2, y = ySb-1..ySb+2, the predicted sample value of the current sub-block is derived as follows:

[0382] bdofOffset=Round((v x *(gradientHL1[x+1][y+1]-gradientHL0[x+1][y+1]))>>1)+Round((v y *(gradientVL1[x+1][y+1]-gradientVL0[x+1][y+1]))>>1) (8-869)

[0383] [Ed.(JC): The Round() operation is defined for floating-point inputs. The Round() operation seems redundant here since the inputs are integer values. To be confirmed by the proposer]

[0384] pbSamples[x][y]=Clip3(0,(2 bitDepth )-1,(predSamplesL0[x+1][y+1]+offset4+predSamplesL1[x+1][y+1]+bdofOffset)>>shift4)

[0385] (8-870)

[0386] 2.10 Example of Decoder-side Motion Vector Refinement (DMVR)

[0387] In the bidirectional prediction operation, for the prediction of a block region, two prediction blocks formed using the motion vectors (MVs) of list 0 and the MVs of list 1, respectively, are combined to form a single prediction signal. In the decoder-side motion vector refinement (DMVR) method, the two motion vectors of the bidirectional prediction are further refined by a bilateral template matching process. Bilateral template matching is applied in the decoder to perform a distortion-based search between the bilateral template and the reconstructed samples in the reference picture to obtain the refined MV without transmitting additional motion information.

[0388] In DMVR, such as Fig.24 As shown, a bilateral template is generated from the initial MV0 of list 0 and MV1 of list 1 as a weighted combination (i.e., average) of the two prediction blocks, respectively. The template matching operation consists of calculating a cost metric between the generated template and the sample area in the reference picture (around the initial prediction block). For each of the two reference pictures, the MV that produces the minimum template cost is considered to be the updated MV of the list to replace the original MV. In JEM, nine MV candidates are searched for each list. The nine candidate MVs include the original MV and 8 surrounding MVs with a luma sample offset to the original MV in the horizontal or vertical direction or in both directions. Finally, as shown in Fig.24 The two new MVs shown, MV0′ and MV1′, are used to generate the final bidirectional prediction result. The sum of absolute differences (SAD) is used as a cost metric. Note that when calculating the cost of a prediction block generated by a surrounding MV, the rounded MV (to integer pixels) is actually used to obtain the prediction block, not the true MV.

[0389] DMVR is applied to the Merge mode of bi-prediction, where one MV comes from the past reference picture and the other comes from the future reference picture, without transmitting additional syntax elements. In JEM, DMVR is not applied when LIC, affine motion, FRUC, or sub-CU Merge candidate is enabled for a CU.

[0390] 2.11JVET-N0236

[0391] This paper proposes a method to refine sub-block based affine motion compensation prediction using optical flow. After performing sub-block based affine motion compensation, the prediction samples are refined by adding the difference derived from the optical flow equation, which is called prediction refinement with optical flow (PROF). This method can achieve inter-frame prediction at pixel level granularity without increasing memory access bandwidth.

[0392] In order to obtain finer motion compensation granularity, the document proposes a method for refining sub-block based affine motion compensation prediction using optical flow. After performing sub-block based affine motion compensation, the brightness prediction samples are refined by adding the difference derived from the optical flow equation. The proposed PROF (prediction refinement using optical flow) is described as the following four steps.

[0393] Step 1) Perform sub-block based affine motion compensation to generate sub-block prediction I(i,j).

[0394] ) Use a 3-tap filter [-1, 0, 1] to calculate the spatial gradient g of the sub-block prediction at each sample point x (i,j) and g y (i,j).

[0395] g x (i,j)=I(i+1,j)-I(i-1,j)

[0396] g y (i,j)=I(i,j+1)-I(i,j-1)

[0397] For gradient calculation, the sub-block prediction is extended by one pixel on each side. To reduce memory bandwidth and complexity, pixels on the extended boundary are copied from the nearest integer pixel position in the reference picture. Thus, additional interpolation of the padded area is avoided.

[0398] Step 3) Calculate the brightness prediction refinement (denoted as ΔI) from the optical flow equation.

[0399] ΔI(i,j)=g x (i,j)*Δv x (i,j)+gy (i,j)*Δv y (i,j)

[0400] where the delta MV (denoted as Δv(i,j)) is the difference between the pixel MV (denoted as v(i,j)) calculated for the sample position (i,j) and the sub-block MV of the sub-block to which the pixel (i,j) belongs, as Fig.25 shown.

[0401] Since the affine model parameters and the pixel position relative to the sub-block center are not changed between sub-blocks, Δv(i,j) can be calculated for the first sub-block and reused for other sub-blocks in the same CU. Assuming x and y are the horizontal and vertical offsets from the pixel position to the sub-block center, Δv(x,y) can be derived by the following equation,

[0402]

[0403] For the 4-parameter affine model,

[0404]

[0405] For the 6-parameter affine model,

[0406]

[0407] Among them, (v 0x ,v 0y )、(v 1x ,v 1y )、(v 2x ,v 2y ) are the motion vectors of the upper left, upper right and lower left control points, and w and h are the width and height of the CU.

[0408] Step 4) Finally, the luma prediction refinement is added to the sub-block prediction I(i,j). The final prediction I' is generated as follows.

[0409] I′(i,j)=I(i,j)+ΔI(i,j)

[0410] Some details from JVET-N0236

[0411] a) How to derive the gradient of PROF

[0412] In JVET-N0263, the gradient is calculated for each sub-block (4×4 sub-block in VTM-4.0) of each reference list. For each sub-block, the nearest integer sample of the reference block is obtained to fill the four outer lines of samples ( Fig.23 black circle in the figure).

[0413] Assume that the MV of the current sub - block is (MVx, MVy). Then the fractional part is calculated as (FracX,FracY)=(MVx&15,MVy&15). The integer part is calculated as (IntX,IntY)=(MVx>>4,MVy>>4). The offset (OffsetX, OffsetY) is derived as:

[0414] OffsetX = FracX>7? 1:0;

[0415] OffsetY = FracY>7? 1:0;

[0416] Assume that the top - left coordinates of the current sub - block are (xCur, yCur), and the size of the current sub - block is W×H.

[0417] Then (xCor0, yCor0), (xCor1, yCor1), (xCor2, yCor2) and (xCor3, yCor3) are calculated as:

[0418] (xCor0,yCor0)=(xCur+IntX+OffsetX - 1,yCur+IntY+OffsetY - 1);

[0419] (xCor1,yCor1)=(xCur+IntX+OffsetX - 1,yCur+IntY+OffsetY+H);

[0420] (xCor2,yCor2)=(xCur+IntX+OffsetX - 1,yCur+IntY+OffsetY);

[0421] (xCor3,yCor3)=(xCur+IntX+OffsetX+W,yCur+IntY+OffsetY);

[0422] Assume that PredSample[x][y] (where x = 0..W - 1, y = 0..H - 1) stores the predicted samples of the sub - block.

[0423] Then the filled samples are derived as

[0424] PredSample[x][ - 1]=(Ref(xCor0+x,yCor0)<<Shift0)-Rounding, for x=-1..W;

[0425] PredSample[x][H]=(Ref(xCor1+x,yCor1)<<Shift0)-Rounding, for x=-1..W;

[0426] PredSample[-1][y] = (Ref(xCor2, yCor2 + y) << Shift0) - Rounding, for y = 0..H - 1;

[0427] PredSample[W][y] = (Ref(xCor3, yCor3 + y) << Shift0) - Rounding, for y = 0..H - 1;

[0428] Where Rec represents the reference picture. Rounding is an integer and equals 2 in an exemplary PROF implementation. 13 . Shift0 = Max(2, (14 - BitDepth));

[0429] PROF attempts to improve the precision of the gradients, which is different from BIO in VTM - 4.0, where the gradients are output with the same precision as the input luminance samples.

[0430] The gradients in PROF are calculated as follows:

[0431] Shift1 = Shift0 - 4.

[0432] gradientH[x][y] = (predSamples[x + 1][y] - predSample[x - 1][y]) >> Shift1

[0433] gradientV[x][y] = (predSample[x][y + 1] - predSample[x][y - 1]) >> Shift1

[0434] It should be noted that predSamples[x][y] maintains the precision after interpolation.

[0435] b) How to derive Δv of PROF

[0436] The derivation of Δv (denoted as dMvH[posX][posY] and dMvV[posX][posY], where posX = 0..W - 1, posY = 0..H - 1) can be described as follows:

[0437] Assume that the size of the current block is cbWidth × cbHeight, the number of control - point motion vectors is numCpMv, and the control - point motion vectors are cpMvLX[cpIdx], where cpIdx = 0..numCpMv - 1, and X is 0 or 1, representing two reference lists.

[0438] The variables log2CbW and log2CbH are derived as follows:

[0439] log2CbW=Log2(cbWidth)

[0440] log2CbH=Log2(cbHeight)

[0441] The variables mvScaleHor, mvScaleVer, dHorX, and dVerX are derived as follows:

[0442] mvScaleHor=cpMvLX[0][0]<<7

[0443] mvScaleVer=cpMvLX[0][1]<<7

[0444] dHorX=(cpMvLX[1][0]-cpMvLX[0][0])<<(7-log2CbW)

[0445] dVerX=(cpMvLX[1][1]-cpMvLX[0][1])<<(7-log2CbW)

[0446] The variables dHorY and dVerY are derived as follows:

[0447] - If numCpMv is equal to 3, the following applies:

[0448] dHorY=(cpMvLX[2][0]-cpMvLX[0][0])<<(7-log2CbH)

[0449] dVerY=(cpMvLX[2][1]-cpMvLX[0][1])<<(7-log2CbH)

[0450] - Otherwise (numCpMv is equal to 2), the following applies:

[0451] dHorY=-dVerX

[0452] dVerY=dHorX

[0453] The variables qHorX, qVerX, qHorY, and qVerY are derived as follows

[0454] qHorX=dHorX<<2;

[0455] qVerX=dVerX<<2;

[0456] qHorY=dHorY<<2;

[0457] qVerY=dVerY<<2;

[0458] dMvH[0][0] and dMvV[0][0] are calculated as follows

[0459] dMvH[0][0]=((dHorX+dHorY)<<1)-((qHorX+qHorY)<<1);

[0460] dMvV[0][0]=((dVerX+dVerY)<<1)-((qVerX+qVerY)<<1);

[0461] dMvH[xPos][0] and dMvV[xPos][0] for xPos from 1 to W-1 are derived as follows:

[0462] dMvH[xPos][0]=dMvH[xPos-1][0]+qHorX;

[0463] dMvV[xPos][0]=dMvV[xPos-1][0]+qVerX;

[0464] For yPos from 1 to H-1, the following applies:

[0465] dMvH[xPos][yPos]=dMvH[xPos][yPos-1]+qHorY, where xPos=0..W-1

[0466] dMvV[xPos][yPos]=dMvV[xPos][yPos-1]+qVerY, where xPos=0..W-1

[0467] Finally, dMvH[xPos][yPos] and dMvV[xPos][yPos] (where posX = 0..W-1, posY = 0..H-1) are right-shifted to

[0468] dMvH[xPos][yPos]=SatShift(dMvH[xPos][yPos],7+2-1);

[0469] dMvV[xPos][yPos]=SatShift(dMvV[xPos][yPos],7+2-1);

[0470] Among them, SatShift(x,n) and Shift(x,n) are defined as

[0471]

[0472] Shift(x,n)=(x+offset0)>>n

[0473] In one example, offset0 and / or offset1 are set to (1 <<n)> >1.

[0474] c) How to derive ΔI of PROF

[0475] For the position (posX, posY) inside the sub-block, its corresponding Δv(i, j) is expressed as (dMvH[posX][posY], dMvV[posX][posY]). Its corresponding gradient is expressed as (gradientH[posX][posY], gradientV[posX][posY]).

[0476] Then ΔI(posX, posY) is derived as follows.

[0477] (dMvH[posX][posY], dMvV[posX][posY]) is clipped to

[0478] dMvH[posX][posY]=Clip3(-32768,32767,dMvH[posX][posY]);

[0479] dMvV[posX][posY]=Clip3(-32768,32767,dMvV[posX][posY]);

[0480] ΔI(posX,posY)=dMvH[posX][posY]×gradientH[posX][posY]+dMvV[posX][posY]×gradientV[posX][posY];

[0481] ΔI(posX,posY)=Shift(ΔI(posX,posY),1+1+4);

[0482] ΔI(posX,posY)=Clip3(-(2 13 -1),2 13 -1,ΔI(posX,posY));

[0483] d) How to derive I' of PROF

[0484] If the current block is not encoded as bidirectional prediction or weighted prediction, then

[0485] I'(posX,posY)=Shift((I(posX,posY)+ΔI(posX,posY)),Shift0),

[0486] I'(posX,posY)=ClipSample(I'(posX,posY)),

[0487] ClipSample clips the sample value to a valid output sample value.

[0488] Then, I'(posX,posY) is output as the inter-frame prediction value.

[0489] Otherwise (the current block is encoded or decoded as bidirectional prediction or weighted prediction)

[0490] I'(posX,posY) will be stored and used to generate inter-frame prediction values ​​based on other prediction values ​​and / or weighted values.

[0491] 2.12 JVET-N 0510

[0492] In JVET-N0510, a phase-varying affine sub-block motion compensation (MV) method is proposed. A conventional two-stage horizontal-vertical interpolation is applied. However, unlike the phase-invariant block-based MV which uses the same horizontal filter for all sample rows and the same vertical filter for all sample columns, different phases of the filter can be applied to different sample rows and different sample columns in the affine sub-block.

[0493] In order to better approximate the affine motion model in the affine sub-block, phase-varying MC is applied to the sub-block. In the proposed method, the affine codec block is also divided into 4×4 sub-blocks, and a sub-block MV is derived for each sub-block as done in VTM4.0. The MC for each sub-block is divided into two stages. The first stage is to filter the (4+L–1)×(4+L–1) reference block window with (4+L–1)-row horizontal filtering, where L is the filter tap length of the interpolation filter. However, unlike the translation MC, in the proposed phase-varying affine sub-block MC, the filtering phase for each sample row is different. For each sample row, MVx is derived as follows.

[0494] MVx=(subblockMVx<<7+dMvVerX×(rowIdx–L / 2–2))>>7

[0495] The filter phase for each sample row is derived from MVx. subblockMVx is the x component of the MV of the derived subblock MV, as done in VTM4.0. rowIdx is the sample row index. dMvVerX is (cuBottomLeftCPMVx–cuTopLeftCPMVx)<<(7–log2LumaCbHeight), where cuBottomLeftCPMVx is the x component of the CU bottom left control point MV, cuTopLeftCPMVx is the x component of the CU top left control point MV, and LumaCbHeight is the log2 of the height of the luma codec block (CB).

[0496] After horizontal filtering, 4×(4+L–1) horizontal filtered samples are generated. Fig.26 The proposed horizontal filtering concept is shown in Figure 1. The grey dots are the samples of the reference block window, and the orange dots represent the horizontal filtering samples. The blue tubes of 8×1 samples represent the application of an 8-tap horizontal filter, respectively. Fig.26 and Fig. 27 As shown. Each sample line requires four horizontal filterings. The filter phases on the sample lines are the same. However, the filter phases on different lines are different. This generates skewed 4×11 samples.

[0497] In the second stage, 4×(4+L–1) horizontal filtered samples ( Fig.26 The orange samples in ( ) are further vertically filtered. For each sample column, MVy is derived as follows.

[0498] MVy=(subblockMVy<<7+dMvHorY×(columnIdx–2))>>7(Equation 2)

[0499] The filter phase for each sample column is derived from MVy. subblockMVy is the y component of the derived MV of the subblock MV, as done in VTM4.0. columnIdx is the sample column index. dMvHorY is (cuTopRightCPMVy–cuTopLeftCPMVy)<<(7–log2LumaCbWidth), where cuTopRightCPMVy is the y component of the CU top right control point MV, cuTopLeftCPMVy is the y component of the CU top left control point MV, and log2LumaCbWidth is the log2 of the width of the luma CB.

[0500] After vertical filtering, 4×4 affine sub-block prediction samples are generated. Fig.28The proposed vertical filtering concept is shown. The light orange dots are the horizontally filtered samples from the first stage. The red dots are the vertically filtered samples as the final prediction samples.

[0501] In this proposal, the interpolation filter set used is the same as in VTM4.0. The only difference is that the horizontal filter phase on one sample row is different, and the vertical filter phase on one sample column is different. For the number of filtering operations per affine sub-block in the proposed method, it is the same as in VTM4.0.

[0502] 3. Disadvantages of existing implementation methods

[0503] Some existing implementations have the following disadvantages:

[0504] (1) The gradient calculation method is different in BDOF and PROF.

[0505] (a) In BDOF, the gradient is calculated for the entire block and padding is performed once. In PROF, the gradient is calculated for each sub-block and padding is performed N times (assuming there are N sub-blocks).

[0506] (b) PROF requires higher gradient accuracy than BDOF.

[0507] (2) The interaction between PROF and other tools is unclear.

[0508] (3) It is not clear how to apply PROF to the chroma components.

[0509] (4) The derivation process of Δv may be incorrect.

[0510] (5) For higher encoding and decoding performance, PROF may be performed conditionally.

[0511] (6) It is unclear how to combine the methods in JVET-N 0236 and JVET-N0510.

[0512] (7) The bit width of dMvH and dMvV may be too large.

[0513] 4. Example Method for Prediction Refinement (PROF) Exploiting Optical Flow

[0514] Embodiments of the currently disclosed technology overcome the shortcomings of existing implementations, thereby providing video codecs with higher codec efficiency. Based on the disclosed technology, methods for predictive refinement using optical flow can enhance existing and future video codec standards, as described in the following examples described for various implementations. The examples of the disclosed technology provided below explain the general concepts and are not meant to be interpreted as limiting. In the examples, the various features described in these examples can be combined unless explicitly indicated to the contrary.

[0515] Ref0 and Ref1 represent the reference pictures of the current picture from list 0 and list 1 respectively, and τ 0 =POC(current)-POC(Ref0), τ 1 =POC(Ref1)-POC(current), and refblk0 and refblk1 represent the reference blocks of the current block from Ref0 and Ref1 respectively. For a sub-block in the current block, the MV of its corresponding sub-block in refblk0 pointing to refblk1 is represented by (v x , v y ) is represented by (mvL0 and mvL1). x ,mvL0 y ) and (mvL1 x ,mvL1 y )express.

[0516] Shift(x,s) is defined as Shift(x,s)=(x+off)>>s.

[0517] SignShift(x,s) is defined as

[0518]

[0519] In the example, offset0 and / or offset1 are set to (1 <<n)> >1 or (1<<(n-1)). In another example, offset0 and / or offset1 are set to 0. In yet another example, offset0=offset1=((1<<n)> >1)-1 or ((1<<(n-1)))-1.

[0520] Clip3(x,min,max) is defined as

[0521]

[0522] In this paper, Max(a,b)=a>=b?a:b, and Min(a,b)=a<=b?a:b.

[0523] In the following discussion, an operation between two motion vectors means that the operation will be applied to both components of the motion vector. For example, MV3 = MV1 + MV2 is equivalent to MV3 x =MV1 x +MV2 x And MV3 y =MV1 y +MV2 y . Alternatively, the operation may be applied only to the horizontal or vertical components of the two motion vectors. The term "absolute value" of MV(MVx, MVy) may refer to abs(MVx), or abs(MVy), or max(abs(MVx), abs(MVy)), or abs(MVx)+abs(MVy), where the function abs(x) returns the absolute value of x and the function max(x, y) returns the larger of x and y.

[0524] In the following discussion, the left neighboring block, the lower left neighboring block, the upper neighboring block, the upper right neighboring block, and the upper left neighboring block are represented as follows: Figure 2 Block A shown 1 , A 0 , B 1 , B 0 and B 2 .

[0525] 1. It is proposed that the gradient computation in PROF can be performed at an M×N region level that is different from the sub-block size used for motion compensation in affine mode.

[0526] a. In one example, the gradient calculation in PROF can be performed on an M×N region larger than a sub-block.

[0527] b. In one example, M and N may be some predefined numbers, for example, M=N=8 or M=N=16.

[0528] c. In one example, M and N may be some number defined according to the width / height of the sub-block size, for example, M=N=2*Wmc, where Wmc is the width / height of the sub-block size used in motion compensation.

[0529] d. The filling process used to derive the gradient in PROF is performed at the M×N region level.

[0530] e. For all the above examples, the definitions of M and N are as follows:

[0531] i. In one example, M = min(K0, block width), where K0 is an integer value.

[0532] ii. In one example, N=min(K1, block height), where K0 is an integer value.

[0533] iii. For the above example, K0=K1=16.

[0534] iv. In one example, K0 and K1 are aligned for BDOF.

[0535] f. The gradient of the first sample point in the first sub-block can be derived using the second sample point in the second sub-block.

[0536] i. In one example, the second sub-block is adjacent to the first sub-block.

[0537] ii. In one example, when the second sample point is in the first sub-block or the second sub-block, the second sample point is used to derive the gradient of the first sample point in the same manner.

[0538] iii. When M×N is larger than the sub-block, the above method can be applied.

[0539] g. One or more MVs can be derived for use in the filling process of each M×N region.

[0540] i. In one example, a specific MV is derived for the filling process of the M×N region. Integer reference samples can be located with the specific MV and then used to fill in samples outside the M×N region.

[0541] (i) In one example, the specific MV may be an MV of a subblock in the M×N region, such as an upper left corner subblock or a center subblock in the M×N region. Fig.31 An example is shown. The MV of sub-block A, B, C, D, or E may be selected as a specific MV.

[0542] (ii) In one example, a specific MV may be derived from an affine model toward a specific location (such as the center) of the M×N region.

[0543] (iii) In one example, a specific MV may be derived from the MVs of sub-blocks in an M×N region.

[0544] a. For example, a specific MV may be derived as the average value of the MVs of all sub-blocks in an M×N region.

[0545] b. For example, a specific MV can be derived as the average of several MVs of the central sub-block.

[0546] i. For example, a particular MV can be derived as Fig.31 The average of several MVs in B, C, D and E.

[0547] ii. For example, a particular MV can be derived as Fig.31 The average of several MVs in B and E.

[0548] iii. For example, a particular MV can be derived as Fig.31 The average values ​​of several MVs in C and D are shown.

[0549] c. For example, a specific MV may be derived as a function of multiple MVs (eg, CPMVs or MVs of sub-blocks).

[0550] ii. In one example, multiple MVs are derived for use in the filling process of the M×N region. Integer reference samples can be located using one of the multiple MVs and then used to fill in samples outside the M×N region.

[0551] (i) In one example, when filling a first sample adjacent to a first subblock of an M×N region, the first MV of the first subblock may be used to locate integer reference sample(s) for filling the first sample.

[0552] iii. The above method is applied when M×N is larger than a sub-block, and the filling process used to derive the gradient in PROF is performed on each M×N region.

[0553] 2. Gradient calculations in PROF / BIO can be performed at the M×N region level, and M / N can be changed adaptively.

[0554] a. In one example, M and N may depend on the size of the current block W×H.

[0555] i. For example, the region may be the entire current block, ie, M=W and N=H.

[0556] ii. For example, M=W / T1 and N=H / T2, where T1 and T2 are integers, for example T1=T2=2.

[0557] iii. In one example, M and / or N may be signaled from the encoder to the decoder, such as in VPS / DPS / SPS / PPS / APS / slice header / slice group header / slice / CTU / CU.

[0558] (i) Alternatively, M and / or N may be specified in a profile / level / tier of a video codec standard.

[0559] iv. In one example, M=Min(W, T1) and N=Min(H, T2).

[0560] For example, T1=T2=16.

[0561] (i) In one example, T1 and / or T2 may be signaled from the encoder to the decoder, such as in VPS / DPS / SPS / PPS / APS / slice header / slice group header / slice / CTU / CU.

[0562] (ii) Alternatively, T1 and / or T2 may be specified in a profile / level / tier of a video codec standard.

[0563] 3. For the above method, the following may further apply:

[0564] a. In one example, M is at least equal to Mmin, and N is at least equal to Nmin, for example, Mmin=Nmin=8.

[0565] b. In one example, a filling process is performed on each M×N region to obtain a filled (M+dM)×(N+dN) region, for example, dM=dN=2.

[0566] i. In one example, the sample points inside the region (such as Fig.23 The white circles in the figure) can be derived from motion compensation with interpolation filtering.

[0567] (i) In one example, samples inside a region may be derived from motion compensation for several sub-blocks in the region.

[0568] ii. In one example, the four outer lines of the sample point (such as Fig.23 black circle in the figure).

[0569] (i) In one example, the sample to be filled may copy the intensity of the nearest integer sample in the reference block.

[0570] (ii) In one example, the sample point to be filled may copy the intensity of the nearest sample point in the unfilled area.

[0571] 4. For each region where the gradient calculation in PROF / BIO is applied, instead of calculating the gradient value for each sample point, it is proposed to calculate the gradient based on some of the sample points.

[0572] a. In one example, the gradient associated with a sample point at given coordinates may be used in PROF / BIO, such as at (2x, y) or (x, 2y) or (2x+1, 2y+1) or (2x, 2y), where (m, n) are the coordinates relative to the top left sample point in the current block.

[0573] b. In one example, the samples may be modified first (eg, downsampled), and the modified samples may be used to derive the gradient.

[0574] 5. It is proposed that the accuracy of the gradient values ​​calculated in BDOF and PROF can be the same.

[0575] a. In one example, the sample point differences can be shifted by the same value.

[0576] i. In one example, the horizontal and / or vertical gradients (respectively represented by gradientH, gradientV) can be calculated as follows:

[0577] gradientH[x][y]=(predSamples[x+1][y]-predSample[x-1][y])>>Shift0

[0578] gradientV[x][y]=(predSample[x][y+1]-predSample[x][y-1])>>Shift1

[0579] Alternatively,

[0580] gradientH[x][y]=Shift((predSamples[x+1][y]-predSample[x-1][y]),Shift0)

[0581] gradientV[x][y]=Shift((predSample[x][y+1]-predSample[x][y-1]),Shift1)

[0582] Alternatively,

[0583] gradientH[x][y]=SatShift((predSamples[x+1][y]-predSample[x-1][y]),Shift0)

[0584] gradientV[x][y]=SatShift((predSample[x][y+1]-predSample[x][y-1]),Shift1)

[0585] ii. In one example, the horizontal and / or vertical gradients (respectively represented by gradientH, gradientV) can be calculated as follows:

[0586] gradientH[x][y]=(predSamples[x][y]*2-predSamples[x+1][y]-predSample[x-1][y])>>Shift0

[0587] gradientV[x][y]=(predSamples[x][y]*2-predSample[x][y+1]-predSample[x][y-1])>>Shift1

[0588] Alternatively,

[0589] gradientH[x][y]=Shift((predSamples[x][y]*2-predSamples[x+1][y]-predSample[x-1][y]),Shift0)

[0590] gradientV[x][y]=Shift((predSamples[x][y]*2-predSample[x][y+1]-predSample[x][y-1]),Shift1)

[0591] Alternatively,

[0592] gradientH[x][y]=SatShift((predSamples[x][y]*2-predSamples[x+1][y]-predSample[x-1][y]),Shift0)

[0593] gradientV[x][y]=SatShift((predSamples[x][y]*2-predSample[x][y+1]-predSample[x][y-1]),Shift1)

[0594] iii. In one example, Shift0 and / or Shift1 may be set to Max(2,(14-BitDepth)), where BitDepth is the bit depth of the reconstructed samples / input samples.

[0595] 6. Fill the outer line of the sample point (represented as a filled sample point, such as Fig.23 The following method (black circles in ) can be applied to PROF, or BIO, or both PROF and BIO.

[0596] a. Filling Sample points can be filled in the same way as PROF and / or BIO. "Same method" can be any filling method disclosed below.

[0597] b. In one example, padding samples may be derived (eg, copied) from integer samples in the reference pictures of PROF and / or BIO.

[0598] i. In one example, the integer samples used to derive the padding samples can be located by the positions of the padding samples, and the MV that can be rounded to an integer MV in the addition operation is added.

[0599] (i) In one example, MV(MvX, MvY) may be rounded down to an integer MV(IntX, IntY). For example, IntX=MvX>>P, IntY=MvY>>P, where P is the MV precision.

[0600] (ii) In one example, MV(MvX, MvY) may be rounded to the nearest integer MV(IntX, IntY). For example, set FracX=MvX&((1< <P)-1),FracY=MvY&((1<<P)-1),OffX=(FracX> =(1<<(P-1)))?1:0, OffY=(FracY>=(1<<(P-1)))?1:0, where P is the MV precision, then IntX=(MvX>>P)+OffX, IntY=(MvY>>P)+OffY. HalfFrac can be equal to 1<<(P-1), in other examples, it can be equal to (1<<(P-1))-1 or (1<<(P-1))+1.

[0601] (iii) In one example, when IntX=SatShift(MvX,P), IntY=SatShift(MvY,P), MV(MvX,MvY) may be rounded to an integer MV(IntX,IntY), where P is the MV precision.

[0602] (iv) In the above bullet points, the MV precision P may depend on the color format and / or color components.

[0603] a. For example, the MV precision of the Cb / Cr component may be equal to the MV precision of the luma component plus K of the 4:2:0 color format. For example, K may be equal to 1.

[0604] (v) How to perform padding can be signaled from the encoder to the decoder, such as in VPS / DPS / SPS / PPS / APS / slice header / slice group header / slice / CTU / CU.

[0605] a. Alternatively, how padding is performed may be specified in the profile / level / tier of the video codec standard.

[0606] (vi) How to pad may depend on the block size.

[0607] 7. It is suggested that codec tool X cannot be used when PROF is used.

[0608] a. Alternatively, when codec X is applied, PROF cannot be applied.

[0609] b. In one example, if codec tool X cannot be applied, the syntax element(s) indicating codec tool X may not be signaled.

[0610] c. In one example, codec X may be generalized bi-directional prediction (GBI).

[0611] i. For example, when GbiIdx is not equal to 0, PROF is not applied.

[0612] ii. Alternatively, when PROF is applied, GbiIdx must be 0.

[0613] iii. Alternatively, when PROF is applied, GbiIdx is not signaled and is inferred to be 0.

[0614] iv. Alternatively, when PROF is applied, GBI is not applied regardless of whether GbiIdx is equal to 0.

[0615] d. In one example, codec tool X may be local illumination compensation.

[0616] e. In one example, codec X may be a Multiple Transform Set (MTS).

[0617] i. For example, when applying PROF, only the default transformation can be applied.

[0618] (i) For example, when PROF is applied, syntax element-related MTS is not applied.

[0619] f. In one example, codec tool X may be weighted prediction.

[0620] i. For example, when unequal weights and / or unequal biases are applied to a block due to weighted prediction, PROF is not applied.

[0621] 8. It is proposed that how PROF is applied may depend on the color format and / or the use of separate plane codecs.

[0622] a. In one example, if the color format is 4:0:0, PROF cannot be applied to the chroma components.

[0623] b. In one example, if the color format is 4:4:4, PROF may be applied to the chroma components.

[0624] c. In one example, if the color format is not equal to 4:0:0, PROF can be applied to the chroma components.

[0625] d. In one example, how to derive the delta MV (eg, Δv in Section 2.11) may depend on the color format.

[0626] 9. It is suggested that how PROF is applied may depend on the color component.

[0627] a. In one example, the gradient may be calculated independently for each color component.

[0628] i. Alternatively, the gradient calculated for the first color component may be used by the second color component.

[0629] ii. Alternatively, the gradient may be calculated twice, once for the luma / primary color component and another time for the two chroma / related color components.

[0630] b. In one example, the delta MV (eg, Δv in Section 2.11) may be calculated independently for each color component.

[0631] i. Alternatively, the delta MV calculated for the first color component may be used by the second color component.

[0632] c. In one example, prediction refinements (eg, ΔI in Section 2.11) may be computed independently for each color component.

[0633] i. Alternatively, the prediction refinement calculated for the first color component (eg, ΔI in Section 2.11) may be used by the second color component.

[0634] d. In one example, the accuracy of the gradient in PROF may depend on the color component.

[0635] e. In one example, the accuracy of the delta MV in PROF (eg, Δv in Section 2.11) may depend on the color component.

[0636] f. In one example, whether and how to perform clipping operations in PROF may depend on the color components.

[0637] g. In one example, whether and how to perform shift operations in PROF may depend on the color components.

[0638] h. In one example, PROF may be applied to the luma component only.

[0639] i. In one example, PROF can be applied to different color components of different sub-block sizes.

[0640] i. Alternatively, PROF can be applied to different color components of the same sub-block size.

[0641] j. In one example, PROF can be applied to chroma components of M*N sub-block size.

[0642] i. For example, M and N are set equal to 4.

[0643] k. The above method (bullet hj) may further depend on the color format (eg, 4:2:0 or 4:4:4).

[0644] 10. It is proposed that the derivation of the delta MV (eg, Δv in Section 2.11) may depend on the width and / or height of the sub-block.

[0645] a. In one example, dMvH[0][0] and dMvV[0][0] are calculated as

[0646] qHorX=dHorX*P0;

[0647] qVerX=dVerX*P0;

[0648] qHorY=dHorY*P0;

[0649] qVerY=dVerY*P0;

[0650] dMvH[0][0]=((iDMvHorX+iDMvVerX)*P1)-(quadHorX*(blockWidth>>1)+quadVerX*(blockHeight*P1));

[0651] dMvV[0][0]=((iDMvHorY+iDMvVerY)*P1)-(quadHorY*(blockWidth>>1)+quadVerY*(blockHeight*P1));

[0652] Where blockWidth and blockHeight represent the width and height of the sub-block respectively. P0 and P1 are two numbers that control the precision.

[0653] i. For example, P0=4 and P1=2, then dMvH[0][0] and dMvV[0][0] are calculated as:

[0654] qHorX=dHorX<<2;

[0655] qVerX=dVerX<<2;

[0656] qHorY=dHorY<<2;

[0657] qVerY=dVerY<<2;

[0658] dMvH[0][0] = ((iDMvHorX + iDMvVerX) << 1) - (quadHorX * (blockWidth >> 1) + quadVerX * (blockHeight >> 1));

[0659] dMvV[0][0] = ((iDMvHorY + iDMvVerY) << 1) - (quadHorY * (blockWidth >> 1) + quadVerY * (blockHeight >> 1)); 11. It is proposed that for the affine encoding and decoding block, PROF can be conditionally performed rather than always being applied.

[0660] a. In one example, whether and how to perform PROF can depend on the size W×H of the current block.

[0661] i. For example, if W <= T1 and / or H <= T2, PROF may not be applied, for example, T1 = T2 = 16;

[0662] ii. For example, if W < T1 and / or H < T2, PROF may not be applied, for example, T1 = T2 = 16;

[0663] iii. For example, if W >= T1 and / or H >= T2, PROF may not be applied, for example, T1 = T2 = 64;

[0664] iv. For example, if W > T1 and / or H > T2, PROF may not be applied, for example, T1 = T2 = 64;

[0665] v. For example, if W * H > T1, PROF may not be applied, for example, T1 = 64 * 64;

[0666] vi. For example, if W * H >= T1, PROF may not be applied, for example, T1 = 64 * 64;

[0667] vii. For example, if W * H < T1, PROF may not be applied, for example, T1 = 16 * 16;

[0668] viii. For example, if W * H <= T1, PROF may not be applied, for example, T1 = 16 * 16;

[0669] ix. For example, if min(W, H) >= T1, PROF may not be applied, for example, T1 = 64;

[0670] x. For example, if min(W, H) > T1, PROF may not be applied, for example, T1 = 64;

[0671] xi. For example, if max(W, H) <= T1, PROF may not be applied, e.g., T1 = 16;

[0672] xii. For example, if max(W, H) < T1, PROF may not be applied, e.g., T1 = 16; b. In one example, whether and / or how to perform PROF may depend on the control point motion vector.

[0673] c. In one example, whether and / or how to perform PROF may depend on the affine parameters and / or the number of affine parameters.

[0674] i. For a 4-parameter affine model, where

[0675]

[0676] whether and how to perform PROF may depend on parameters a and b.

[0677] ii. For a 4-parameter affine model, where

[0678]

[0679] whether and how to perform PROF may depend on parameters a, b, c, and d.

[0680] iii. In one example, if the maximum affine parameter is less than (or not greater than) a threshold, PROF may not be applied.

[0681] (i) Alternatively, if all (such as four or six) affine parameters are less than (or not greater than) a threshold, PROF may not be applied.

[0682] (ii) Alternatively, if at least one affine parameter is less than (or not greater than) a threshold, PROF may not be applied.

[0683] iv. In one example, if the maximum value of the absolute values of the affine parameters is less than (or not greater than) a threshold, PROF may not be applied.

[0684] (i) Alternatively, if the absolute values of all affine parameters are less than (or not greater than) a threshold, PROF may not be applied.

[0685] (ii) Alternatively, PROF can be applied only when at least one of the absolute values of all affine parameters is greater than (or not less than) a threshold.

[0686] v. In one example, if the minimum affine parameter is greater than (or not less than) a threshold, PROF may not be applied.

[0687] (i) Alternatively, if all (such as four or six) affine parameters are greater than (or not less than) a threshold, PROF may not be applied.

[0688] (ii) Alternatively, if at least one affine parameter is greater than (or not less than) a threshold, PROF may not be applied.

[0689] vi. In one example, if the minimum value of the absolute values ​​of the affine parameters is greater than (or not less than) a threshold value, PROF may not be applied.

[0690] (i) Alternatively, if the absolute values ​​of all affine parameters are greater than (or not less than) a threshold, PROF may not be applied.

[0691] (ii) Alternatively, PROF may be applied only when at least one of the absolute values ​​of the affine parameters is smaller than (or not larger than) a threshold value.

[0692] vii. In one example, if the maximum value of the “absolute value” of the delta MV as disclosed in JVET-N0236 is less than (or not greater than) a threshold value, PROF may not be applied.

[0693] (i) Alternatively, if the "absolute values" of all incremental MVs are smaller than (or not larger than) a threshold, PROF may not be applied.

[0694] (ii) Alternatively, PROF can be applied only when at least one of the "absolute values" of the incremental MVs is greater than (or not less than) a threshold. viii. In one example, PROF may not be applied if the minimum "absolute value" of the incremental MVs is greater than (or not less than) a threshold.

[0695] (i) Alternatively, if the "absolute values" of all incremental MVs are greater than (or not less than) a threshold, PROF may not be applied.

[0696] (ii) Alternatively, PROF may be applied only when at least one of the "absolute values" of the delta MVs is greater than (or not less than) a threshold value.

[0697] ix. In one example, PROF may be applied to certain locations.

[0698] (i) For example, if the "absolute value" of the corresponding delta MV of a position is less than (or not greater than) a threshold value, then PROF may be applied to the position.

[0699] (ii) For example, if the “absolute value” of the corresponding delta MV of a position is greater than (or not less than) a threshold value, then PROF may be applied to the position.

[0700] x. In one example, the affine parameters may be represented as integers dHorX, dVerX, dHorY, and dVerY with a certain precision as described in JVET-M1001.

[0701] xi. In one example, the threshold may depend on the bit depth.

[0702] (i) In one example, the threshold can be derived as 1< <BitDepth。

[0703] (ii) Furthermore, alternatively, the threshold value may depend on whether bidirectional prediction or unidirectional prediction is applied.

[0704] a. For example, the threshold can be derived as (1 < <BitDepth)+(Bi-prediction?1:0)。

[0705] xii. In one example, whether and / or how to apply the method disclosed in bullet point 11 may depend on the reference picture structure.

[0706] (i) For example, if all reference pictures of the current picture precede the current picture in display order, ie, the POC of all reference pictures is smaller than the POC of the current picture, one or more of the disclosed methods may not be applied.

[0707] (ii) Alternatively, whether and / or how to apply the method disclosed in bullet point 11 may depend on the slice / picture type (such as I slice or B slice).

[0708] (iii) Alternatively, whether and / or how to apply the method disclosed in bullet point 11 may depend on the temporal layer.

[0709] xiii. In bullet point 11, the codec method "PROF" may be replaced by other codec methods to enhance affine prediction codec, such as interlaced prediction or phase-variant affine sub-block motion compensation as disclosed in JVET-N0216.

[0710] 12. It is proposed that phase-variant affine sub-block motion compensation, such as proposed in JVET-N0510, can be applied first to obtain prediction values, and then PROF

[0711] 13. It is proposed that the bit width of any variable used to derive dMvH[x][y] and / or dMvV[x][y] for any valid x and y cannot exceed a certain number, such as 32.

[0712] a. In one example, dMvH[x][y] and / or dMvV[x][y] are clipped before being used to derive other dMvH[t][z] and / or dMvV[t][z], where (t, z) is not equal to (x, y).

[0713] b. In one example, dMvH[x][y] and / or dMvV[x][y] are right shifted before being used to derive other dMvH[t][z] and / or dMvV[t][z], where (t, z) is not equal to (x, y).

[0714] 14. It is proposed that dMvH and / or dMvV may have the same precision as the stored motion vectors.

[0715] a. For example,

[0716] dMvH[xPos][yPos]=SatShift(dMvH[xPos][yPos],7+M);

[0717] dMvV[xPos][yPos]=SatShift(dMvV[xPos][yPos],7+M);

[0718] Wherein M is the additional precision used to derive dMvH and / or hMvV, for example, M=2.

[0719] 15. It is proposed that the clipping of dMvH and / or dMvV before being used to derive the prediction refinement ΔI may depend on the accuracy of dMvH and / or dMvV.

[0720] a. For example

[0721] dMvH[posX][posY]=Clip3(-2 K-1 ,2 K-1 -1,dMvH[posX][posY]);

[0722] dMvV[posX][posY]=Clip3(-2 K-1 ,2 K-1 -1,dMvV[posX][posY]);

[0723] where K depends on the accuracy of dMvH and / or dMvV.

[0724] b. Alternatively, dMvH[x][y] and / or dMvV[x][y] are not pruned before being used to derive prediction refinement.

[0725] 16. It is proposed that the right shift of the prediction refinement ΔI(posX, posY) may depend on the sign of ΔI(posX, posY).

[0726] a. For example, ΔI(posX,posY)=SatShift(ΔI(posX,posY),N), where N is an integer.

[0727] 17. It is proposed that the clipping of the prediction refinement ΔI(posX, posY) can depend on the sample bit depth.

[0728] a. For example, ΔI(posX,posY)=Clip3(-(2 3+BitDepth -1),2 3+BitDpeth -1,ΔI(posX,posY));

[0729] 18. Whether and / or how deblocking is performed on sub-block boundaries (e.g., internal sub-block boundaries) within an affine mode block may depend on whether interlaced prediction or / and PROF or / and phase-variant affine sub-block motion compensation as disclosed in JVET-N0216 is applied to the block.

[0730] a. In one example, when interlaced prediction or / and PROF or / and phase-variant affine sub-block motion compensation is applied to a block, deblocking may be disabled.

[0731] i. Alternatively, the deblocking filter may be weaker on subblock boundaries where interleaved prediction or / and PROF or / and phase-variant affine subblock motion compensation is applied to the block. For example, the boundary strength may be set to be smaller on such boundaries.

[0732] b. In one example, when interlaced prediction or / and PROF or / and phase-variant affine sub-block motion compensation are not applied to a block, deblocking may be enabled.

[0733] The examples described above may be incorporated into the context of the methods described below that may be implemented at a video decoder or a video encoder (eg, methods 2910 to 2950 ).

[0734] Fig.29A A flowchart of an exemplary method for video processing is shown. Method 2910 includes, at step 2912, generating a prediction block for a current video block of a video using affine mode motion compensation performed at a sub-block level of the current video block. Method 2910 also includes, at step 2914, performing gradient calculations on a region of the current video block to refine the prediction block using a prediction refinement using optical flow (PROF) process, wherein the size of the region (M×N) is different from the size of the sub-block of the current video block, wherein M and N are positive integers. Method 2910 also includes, at step 2916, performing a conversion between the current video block and a codec representation of the video based on the gradient calculations.

[0735] Fig.29B A flow chart of an exemplary method for video processing is shown. The method 2920 includes, at step 2922, deriving a final prediction block for a current video block of a video having a first size, wherein the final prediction block is calculated by refining one or more intermediate prediction blocks using a gradient calculation performed on a video region having a second size according to a rule, wherein the refinement uses an optical flow process. The method 2920 also includes, at step 2924, using the final prediction block to perform a conversion between the current video block and a codec representation of the video.

[0736] Fig.29C A flowchart of an exemplary method for video processing is shown. Method 2930 includes, at step 2932, deriving motion information for a current video block of a video using bidirectional optical flow (BDOF) or prediction refinement using optical flow (PROF). Method 2930 also includes, at step 2934, performing gradient calculations on samples in a region of the current video block such that at least one sample in the region is omitted from the gradient calculations. Method 2930 also includes, at step 2936, performing a conversion between a current video block and a codec representation of a video including the current video block based on the gradient calculations. In some embodiments, one or more initial predictions for the current video block are calculated at a sub-block level and refined using optical flow calculations during PROF, or one or more initial predictions are refined using spatial and temporal gradients during BDOF.

[0737] Fig.29D A flow chart of an exemplary method for video processing is shown. The method 2940 includes, at step 2942, determining a final prediction block for a current video block of a video by refining one or more initial predictions of the current video block of the video based on gradients of initial prediction samples according to a precision rule using an optical flow calculation. The method 2940 also includes, at step 2944, performing a conversion between the current video block and a codec representation using the final prediction block, wherein the optical flow calculation includes a prediction refinement (PROF) process or a bidirectional optical flow (BDOF) process using optical flow, wherein the precision rule specifies using the same precision for representing gradients of both the PROF process and the BDOF process.

[0738] Fig.29EA flow chart of an exemplary method for video processing is shown. Method 2950 includes, at step 2952, refining one or more initial predictions of a current video block of a video by using an optical flow calculation, determining a final prediction block of the current video block for conversion between the current video block and a codec representation of the video. Method 2950 also includes, at step 2954, using the final prediction block to perform the conversion. In some embodiments, the optical flow calculation includes using a prediction refinement of optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process, wherein the optical flow calculation also includes a padding operation applied to at least one of the PROF process or the BDOF process according to a rule to derive padding samples.

[0739] 5. Example Implementations of the Disclosed Technology

[0740] Fig. 30A is a block diagram of a video processing device 3000. Device 3000 can be used to implement one or more of the methods described herein. Device 3000 can be embodied in a smart phone, a tablet computer, a computer, an Internet of Things (IoT) receiver, etc. Device 3000 may include one or more processors 3002, one or more memories 3004, and video processing hardware 3006. (Multiple) processors 3002 can be configured to implement one or more methods described in this document (including but not limited to method 2900). Memory (multiple memories) 3004 can be used to store data and code for implementing the methods and techniques described herein. Video processing hardware 3006 can be used to implement some of the techniques described in this document in hardware circuits.

[0741] Fig. 30B is another example of a block diagram of a video processing system in which the disclosed technology may be implemented. Fig. 30B 4100 is a block diagram illustrating an example video processing system 4100 in which various techniques disclosed herein may be implemented. Various embodiments may include some or all of the components of system 4100. System 4100 may include an input 4102 for receiving video content. The video content may be received in a raw or uncompressed format, such as 8 or 10 bit multi-component pixel values, or may be in a compressed or encoded format. Input 4102 may represent a network interface, a peripheral bus interface, or a storage interface. Examples of network interfaces include wired interfaces such as Ethernet, a Passive Optical Network (PON), and the like, and wireless interfaces such as Wi-Fi or cellular interfaces.

[0742] System 4100 may include a codec component 4104 that can implement various codecs or encoding methods described in this document. Codec component 4104 can reduce the average bit rate of the video from input 4102 to the output of codec component 4104 to generate a codec representation of the video. Codec technology is therefore sometimes referred to as video compression or video transcoding technology. The output of codec component 4104 can be stored or sent via a communication connection such as represented by component 4106. The bitstream (or codec) representation of the storage or communication transmission of the video received at input 4102 can be used by component 4108 to generate pixel values ​​or transmit to the displayable video of display interface 4110. The process of generating user-visible video from bitstream representation is sometimes referred to as video decompression. In addition, although some video processing operations are referred to as "codec" operations or tools, it will be understood that codec tools or operations are used at encoders, and the corresponding decoding tools or operations of the inverse codec results will be performed by decoders.

[0743] Examples of peripheral bus interfaces or display interfaces may include Universal Serial Bus (USB), High Definition Multimedia Interface (HDMI), or Displayport, etc. Examples of storage interfaces include SATA (Serial Advanced Technology Attachment), PCI, IDE interfaces, etc. The technology described in this document may be embodied in various electronic devices, such as mobile phones, laptops, smart phones, or other devices capable of performing digital data processing and / or video display.

[0744] Some embodiments of the disclosed technology include making a decision or determination to enable a video processing tool or mode. In an example, when a video processing tool or mode is enabled, the encoder will use or implement the tool or mode in the processing of a video block, but may not necessarily modify the generated bitstream based on the use of the tool or mode. That is, when a video processing tool or mode is enabled based on a decision or determination, the conversion from a block of video to a bitstream representation of the video will use the video processing tool or mode. In another example, when a video processing tool or mode is enabled, the decoder will process the bitstream knowing that the bitstream has been modified based on the video processing tool or mode. That is, the conversion from the bitstream representation of the video to the block of the video will be performed using the video processing tool or mode enabled based on the decision or determination.

[0745] Some embodiments of the disclosed technology include making a decision or determination to disable a video processing tool or mode. In an example, when the video processing tool or mode is disabled, the encoder will not use the tool or mode in the conversion of blocks of video to a bitstream representation of the video. In another example, when the video processing tool or mode is disabled, the decoder will process the bitstream knowing that the bitstream has not been modified using the video processing tool or mode that was disabled based on the decision or determination.

[0746] In this document, the term "video processing" may refer to video encoding, video decoding, video compression, or video decompression. For example, a video compression algorithm may be applied during conversion from a pixel representation of a video to a corresponding bitstream representation, or vice versa. The bitstream representation of a current video block may, for example, correspond to bits that are concatenated or interspersed at different locations within the bitstream, as defined by a syntax. For example, a macroblock may be encoded based on error residual values ​​from a transform and codec and also using bits in a header and other fields in the bitstream.

[0747] It should be appreciated that the disclosed methods and techniques will benefit video encoder and / or decoder embodiments incorporated into video processing devices such as smartphones, laptops, desktop computers, and similar devices by enabling use of the techniques disclosed in this document.

[0748] Various techniques and embodiments may be described using the following clause-based format.

[0749] The first set of clauses describes certain features and aspects of the technology disclosed in the previous sections.

[0750] 1. A method for video processing, comprising: performing gradient calculations in a first region of a current video block, wherein a size (M×N) of the first region is different from a size of a sub-block of the current video block for motion compensation in an affine mode, and wherein M and N are positive integers; and performing conversion between the current video block and a bitstream representation of a video including the current video block based on the gradient calculations.

[0751] 2. A method according to clause 1, wherein the size of the first region is larger than the size of the sub-block.

[0752] 3. The method according to clause 1 or 2, wherein M and N are predefined positive integers.

[0753] 4. A method according to clause 1 or 2, wherein the size of the first region is based on the size of the sub-block.

[0754] 5. The method of clause 1, wherein M / N is adaptively changed.

[0755] 6. The method of clause 1, wherein M and N are based on a size of a current video block.

[0756] 7. A method according to any of clauses 1 to 6, wherein M has a minimum value Mmin, and wherein N has a minimum value Nmin.

[0757] 8. The method of clause 7, wherein Mmin=Nmin=8.

[0758] 9. A method according to any of clauses 1 to 6, wherein the first region is filled to generate a first filled region of size (M+dM)×(N+dN).

[0759] 10. The method of clause 9, wherein the samples in the first region or the first padding region are derived based on motion compensation with interpolation filtering.

[0760] 11. The method of clause 1, wherein at least one sample point in the first region is omitted when performing the gradient calculation.

[0761] 12. The method of clause 1, wherein gradient computation is performed with a first precision in bidirectional optical flow (BDOF) and is performed with a second precision in prediction refinement with optical flow (PROF), and wherein the first precision and the second precision are equal.

[0762] 13. A method for video processing, comprising: making a decision regarding selective application of a codec tool to a current video block based on selective application of a prediction refinement utilizing optical flow (PROF) to the current video block, wherein the codec tool is different from the PROF; and performing a conversion between the current video block and a bitstream representation of a video including the current video block based on the decision.

[0763] 14. The method of clause 13, wherein PROF is not applied and CODEC TOOL is applied.

[0764] 15. The method of clause 13, wherein the codec tool comprises generalized bidirectional prediction.

[0765] 16. The method of clause 15, wherein PROF is not applied, and wherein the index associated with generalized bidirectional prediction is non-zero.

[0766] 17. The method of clause 13, wherein the codec tool is local illumination compensation.

[0767] 18. The method of clause 13, wherein the codec tool is a Multiple Transform Set (MTS).

[0768] 19. The method of clause 18, wherein PROF is applied and only a default transform from MTS is applied to the current video block.

[0769] 20. The method of clause 13, wherein the encoding and decoding tool is weighted prediction.

[0770] 21. A method for video processing, comprising: making a decision regarding selective application of a prediction refinement using optical flow (PROF) operation during conversion between a current video block and a bitstream representation of a video including the current video block, wherein the decision is based on color information of the current video block.

[0771] 22. The method of clause 21, wherein the PROF operation is not applied to one or more chroma components of the current video block, and wherein the color information comprises a 4:0:0 color format.

[0772] 23. The method of clause 21, wherein the PROF operation is applied to one or more chroma components of the current video block, and wherein the color information comprises a 4:4:4 color format.

[0773] 24. The method of clause 21, wherein the PROF operation is applied to one or more chroma components of the current video block, and wherein the color information comprises a 4:0:0 color format.

[0774] 25. The method of clause 21, wherein a PROF operation is applied, and wherein the color information comprises a plurality of color components

[0775] 26. The method of clause 25, wherein the one or more gradients of the PROF operation are calculated independently for each of the plurality of color components.

[0776] 27. The method of clause 25, wherein one or more gradients of the PROF operation are calculated for a first color component of the plurality of color components and reused for a second color component of the plurality of color components.

[0777] 28. A method according to clause 26 or 27, wherein the accuracy of the gradient is based on at least one of the plurality of color components.

[0778] 29. A method for video processing, comprising: making a decision regarding selective application of a prediction refinement (PROF) operation utilizing optical flow based on a height (H) or a width (W) of a current video block; and performing a conversion between the current video block and a bitstream representation of a video including the current video block based on the decision.

[0779] 30. The method of clause 29, wherein the PROF operation is applied to a luma component of the current video block.

[0780] 31. The method of clause 29, wherein the current video block is encoded and decoded using an affine mode.

[0781] 32. The method of clause 31, wherein a PROF operation is not applied, wherein W≤T1 and / or H≤T2, and wherein T1=T2=16.

[0782] 33. The method of clause 31, wherein a PROF operation is not applied, wherein W≥T1 and / or H≥T2, and wherein T1=T2=64.

[0783] 34. The method of clause 31, wherein a PROF operation is not applied, wherein W×H≤T or max(W,H)≤T, and wherein T=16.

[0784] 35. The method of clause 31, wherein a PROF operation is not applied, wherein W×H≥T or min(W,H)≥T, and wherein T=64.

[0785] 36. A method as described in clause 1 or 2, wherein the current video block has a size of W×H, where M=min(K,W), and where K is an integer.

[0786] 37. A method as described in clause 1 or 2, wherein the current video block has a size of W×H, where N=min(K,H), and where K is an integer.

[0787] 38. A method according to clause 36 or 37, wherein K=16.

[0788] 39. The method according to clause 1 or 2 further includes: before performing the gradient calculation, performing a filling process in the first area of ​​the current video block.

[0789] 40. The method of clause 39, wherein performing the filling process comprises deriving one or more motion vectors.

[0790] 41. A method according to clause 40, wherein the one or more motion vectors include a motion vector derived from an affine model towards a specific position of the first region.

[0791] 42. A method as described in clause 40, wherein the one or more motion vectors include a motion vector derived from at least one motion vector of at least one sub-block of the first region.

[0792] 43. The method of clause 39, wherein performing the padding process is based on a height or a width of the current video block.

[0793] 44. A method according to clause 39, wherein the filling process is performed based on signaling notification in a video parameter set (VPS), a decoder parameter set (DPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a slice header, a slice, a slice group header, a codec tree unit (CTU) or a codec unit (CU).

[0794] 45. A method according to clause 5 or 6, wherein M and N are signaled in a video parameter set (VPS), a decoder parameter set (DPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a slice header, a slice, a slice group header, a codec tree unit (CTU) or a codec unit (CU).

[0795] 46. ​​A method according to clause 5 or 6, wherein M and N are specified in a profile, level or layer of a video codec standard.

[0796] 47. An apparatus in a video system, comprising a processor and a non-transitory memory having instructions thereon, wherein the instructions, when executed by the processor, cause the processor to perform the method of any one of clauses 1 to 46.

[0797] 48. A computer program product stored on a non-transitory computer readable medium, the computer program product comprising program code for performing the method according to any of clauses 1 to 46.

[0798] The second set of clauses describes certain features and aspects of the technology disclosed in previous sections (including, for example, Example Implementations 1-4).

[0799] 1. A method for video processing, comprising: generating a prediction block for a current video block of a video using affine mode motion compensation performed at a sub-block level of the current video block; performing gradient calculations on a region of the current video block to refine the prediction block using a prediction refinement with optical flow (PROF) process, wherein a size (M×N) of the region is different from a size of a sub-block of the current video block, wherein M and N are positive integers; and performing conversion between the current video block and a codec representation of the video based on the gradient calculations.

[0800] 2. A method according to clause 1, wherein the size of the region is larger than the size of the sub-block.

[0801] 3. The method according to clause 1 or 2, wherein M and N are predefined positive integers.

[0802] 4. A method according to clause 1 or 2, wherein the size of the region is based on the size of the sub-block.

[0803] 5. The method of clause 1, wherein a filling operation in the PROF process is applied to derive gradients at the (M×N) region level.

[0804] 6. A method according to any of clauses 1 to 5, wherein M is defined as min(K0, block width) and N is defined as min(K1, block height), where K0 and K1 are integers.

[0805] 7. The method of clause 6, wherein K0 and K1 are equal to 16.

[0806] 8. The method of clause 1, wherein performing the gradient calculation comprises obtaining a first gradient for a first sample in a first subblock of the current video block and a second gradient for a second sample in a second subblock of the current video block.

[0807] 9. The method of clause 8, wherein the second sub-block is adjacent to the first sub-block.

[0808] 10. The method of clause 8, wherein the second sample point is used to derive the first gradient.

[0809] 11. A method according to any of clauses 8 to 10, wherein the size of the region (M x N) is larger than the size of a sub-block of the current video block.

[0810] 12. The method of clause 1, wherein one or more motion vectors are derived for use in a filling operation of a region.

[0811] 13. The method of clause 12, wherein specific motion vectors associated with integer samples in a reference block of the current video block are derived for the filling operation of the region.

[0812] 14. A method according to clause 13, wherein the particular motion vector corresponds to a motion vector of one of the sub-blocks in the region.

[0813] 15. A method according to clause 13, wherein the specific motion vector is derived by applying an affine model towards a specific position of the region.

[0814] 16. A method according to clause 13, wherein the particular motion vector is derived from the motion vectors of all sub-blocks in the region.

[0815] 17. A method according to clause 13, wherein the specific motion vector is derived as an average of the motion vectors of all sub-blocks in the region.

[0816] 18. A method according to clause 13, wherein the specific motion vector is derived as an average value of at least some of the motion vectors of sub-blocks in the region, the sub-blocks being located around a centre of the region.

[0817] 19. A method according to clause 13, wherein the particular motion vector is derived as a function of a plurality of motion vectors, wherein the plurality of motion vectors comprises a control point motion vector or a motion vector of a sub-block in a region.

[0818] 20. The method of clause 12, wherein a plurality of motion vectors associated with integer samples in a reference block of the current video block are derived for use in the filling operation of the region.

[0819] 21. A method according to clause 20, wherein, to fill a first sample adjacent to a first subblock of a region, a first motion vector of the first subblock in the region is used to locate integer samples.

[0820] 22. The method of clause 12, wherein the size of the region (M x N) is larger than the size of a sub-block of the current video block.

[0821] 23. A method according to any of clauses 1 to 22, wherein minimum values ​​of M and N are predetermined as Mmin and Nmin, respectively.

[0822] 24. The method of clause 23, wherein Mmin=Nmin=8.

[0823] 25. A method according to any of clauses 1 to 24, wherein the padding operation is performed on a region to generate padding samples in a padding region of size (M+dM) x (N+dN).

[0824] 26. A method according to clause 25, wherein samples inside the region are derived from motion compensation with interpolation filtering.

[0825] 27. A method according to clause 26, wherein the samples are derived from motion compensation for several sub-blocks in the region.

[0826] 28. The method of clause 25, wherein the fill points are derived along four outer sides of the region.

[0827] 29. A method as described in clause 28, wherein the padding samples replicate the intensity of the nearest integer sample in a reference block of the current video block.

[0828] 30. The method of clause 28, wherein the filling sample replicates the intensity of the nearest sample in the unfilled area.

[0829] 31. A method according to any of clauses 1 to 30, wherein performing the conversion comprises generating a codec representation from the current video block.

[0830] 32. A method according to any of clauses 1 to 30, wherein performing the conversion comprises generating the current video block from a codec representation.

[0831] 33. A method of video processing, comprising: deriving a final prediction block for a current video block of a video having a first size, wherein the final prediction block is calculated by refining one or more intermediate prediction blocks using gradient calculations performed on a video region having a second size according to a rule, wherein the refinement uses an optical flow process; and using the final prediction block to perform a conversion between the current video block and a codec representation of the video.

[0832] 34. A method according to clause 33, wherein the rule specifies that the second size is a function of the first size.

[0833] 35. A method according to clause 34, wherein the rule specifies that the width of the second dimension (M) and / or the height of the second dimension (N) depends on the width of the first dimension (W) and / or the height of the first dimension (H).

[0834] 36. The method of clause 35, wherein M=W and N=H.

[0835] 37. The method of clause 35, wherein M=N=2*Wmc, and Wmc is the width or height of a sub-block of the current video block used to obtain one or more intermediate prediction blocks using motion compensation for the current video block.

[0836] 38. A method according to clause 35, wherein at least one of M and N is signaled in a video parameter set (VPS), a decoding parameter set (DPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a slice header, a slice group header, a slice, a codec tree unit or a codec unit.

[0837] 39. The method of clause 35, wherein at least one of M and N is specified in a profile, level or hierarchy of rules.

[0838] 40. The method of clause 35, wherein M = Min(W, T1) and N = Min(H, T2), wherein T1 and T2 are positive integers.

[0839] 41. A method according to clause 40, wherein at least one of T1 and T2 is signaled in a video parameter set (VPS), a decoding parameter set (DPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a slice header, a slice group header, a slice, a codec tree unit or a codec unit.

[0840] 42. The method of clause 40, wherein at least one of T1 and T2 is specified in a profile, level or hierarchy of rules.

[0841] 43. A method according to any of clauses 35 to 42, wherein minimum values ​​of M and N are predetermined as Mmin and Nmin, respectively.

[0842] 44. The method of clause 43, wherein Mmin=Nmin=8.

[0843] 45. A method according to any of clauses 33 to 44, wherein the padding operation is performed on a region to generate padding samples in a padding region of size (M+dM) x (N+dN).

[0844] 46. ​​A method according to clause 45, wherein samples inside the region are derived from motion compensation with interpolation filtering.

[0845] 47. A method according to clause 46, wherein the samples are derived from motion compensation for several sub-blocks in the region.

[0846] 48. The method of clause 45, wherein the fill points are derived along four outer sides of the region.

[0847] 49. A method as described in clause 48, wherein the padding samples replicate the intensity of the nearest integer sample in a reference block of the current video block.

[0848] 50. The method of clause 48, wherein the filling sample replicates the intensity of the nearest sample in the unfilled area.

[0849] 51. A method according to clause 33, wherein the optical flow process comprises a prediction refinement using optical flow (PROF) process in which one or more intermediate prediction blocks are calculated at a sub-block level and refined using the optical flow calculation.

[0850] 52. A method as described in clause 33, wherein the optical flow process comprises a bidirectional optical flow (BDOF) process in which one or more intermediate prediction blocks are refined using spatial and temporal gradients.

[0851] 53. A method according to any of clauses 33 to 52, wherein performing the conversion comprises generating a codec representation from the current video block.

[0852] 54. A method according to any of clauses 33 to 52, wherein performing the conversion comprises generating the current video block from a codec representation.

[0853] 55. A method for video processing, comprising: deriving motion information for a current video block of a video using bidirectional optical flow (BDOF) or prediction refinement using optical flow (PROF); performing gradient calculations on samples in a region of the current video block such that at least one sample in the region is omitted from the gradient calculations; and performing conversion between the current video block and a codec representation of a video including the current video block based on the gradient calculations, wherein one or more initial predictions of the current video block are calculated at a sub-block level and refined using optical flow calculations during PROF, or one or more initial predictions are refined using spatial and temporal gradients during BDOF.

[0854] 56. A method according to clause 55, wherein the gradient associated with a sample point at a given coordinate is used in BIO and PROF

[0855] 57. The method of clause 55, wherein the sample points are modified prior to performing the gradient calculation and the modified sample points are used during performing the gradient calculation.

[0856] 58. A method according to any of clauses 55 to 57, wherein performing the conversion comprises generating a codec representation from the current video block.

[0857] 59. A method according to any of clauses 55 to 57, wherein performing the conversion comprises generating the current video block from a codec representation.

[0858] The third set of clauses describes certain features and aspects of the technology disclosed in the previous sections (including, for example, Example Implementations 5 and 6).

[0859] 1. A method of video processing, comprising: determining a final prediction block for a current video block of a video by refining one or more initial predictions of the current video block based on gradients of initial prediction samples according to a precision rule using an optical flow calculation; and performing a conversion between the current video block and a codec representation using the final prediction block, wherein the optical flow calculation comprises a prediction refinement using optical flow (PROF) process or a bidirectional optical flow (BDOF) process, wherein the precision rule specifies that the same precision is used to represent gradients for both the PROF process and the BDOF process.

[0860] 2. A method according to clause 1, wherein, during the PROF process, one or more initial predictions are calculated at sub-block level during affine motion compensated prediction and refined using optical flow calculations.

[0861] 3. A method according to clause 1, wherein, during the BDOF process, one or more initial predictions are refined using at least one gradient value obtained during the optical flow computation.

[0862] 4. A method according to clause 1, wherein the horizontal gradient and the vertical gradient, denoted as gradientH and gradientV respectively, are calculated as one of the following:

[0863] i) gradientH[x][y]=(predSamples[x+1][y]-predSample[x-1][y])>>Shift0, gradientV[x][y]=(predSample[x][y+1]-predSample[x][y-1])>>Shift1,

[0864] ii) gradientH[x][y]=Shift((predSamples[x+1][y]-predSample[x-1][y]),Shift0), gradientV[x][y]=Shift((predSample[x][y+1]-predSample[x][y-1]),Shift1),

[0865] or

[0866] iv) gradientH[x][y]=Shift(predSamples[x+1][y],Shift0)-Shift(predSample[x-1][y],Shift0), gradientV[x][y]=Shift(predSample[x][y+1],Shift0)-predSample[x][y-1],Shift1), and

[0867] Where Shift(x,n) is defined as Shift(x,n)=(x+offset0)>>n, and Satshift(x,n) is defined as

[0868] 5. A method according to clause 1, wherein the horizontal gradient and the vertical gradient, denoted as gradientH and gradientV respectively, are calculated as one of the following:

[0869] i)gradientH[x][y]=(predSamples[x][y]*2-predSamples[x+1][y]-predSample[x-1][y])>>Shift0, gradientV[x][y]=(predSamples[x][y]*2-predSample[x][y+1]-predSample[x][y-1])>>Shift1,

[0870] ii)gradientH[x][y]=Shift((predSamples[x][y]*2-predSamples[x+1][y]-predSample[x-1][y]),Shift0) , gradientV[x][y]=Shift((predSamples[x][y]*2-predSample[x][y+1]-predSample[x][y-1]),Shift1), or

[0871] iii)gradientH[x][y]=SatShift((predSamples[x][y]*2-predSamples[x+1][y]-predSample[x-1][y]),Shift0 ), gradientV[x][y]=SatShift((predSamples[x][y]*2-predSample[x][y+1]-predSample[x][y-1]),Shift1), and

[0872] Where Shift(x,n) is defined as Shift(x,n)=(x+offset0)>>n, and Satshift(x,n) is defined as:

[0873]

[0874] 6. A method according to clause 4 or 5, wherein Shift0 and / or Shift1 is set to Max(2,(14-BitDepth)), and wherein BitDepth represents the bit depth of the reconstructed samples or the input samples.

[0875] 7. A method according to any of clauses 1 to 6, wherein Shift0 and / or Shift1 used in PROF and BDOF are the same.

[0876] 8. A method according to any of clauses 1 to 7, wherein performing the conversion comprises generating a codec representation from the current video block.

[0877] 9. A method according to any of clauses 1 to 7, wherein performing the conversion comprises generating the current video block from a codec representation.

[0878] 10. A video processing method, comprising: refining one or more initial predictions of a current video block of a video by using optical flow calculation, determining a final prediction block of the current video block for conversion between the current video block and a codec representation of the video; and using the final prediction block to perform the conversion, wherein the optical flow calculation includes utilizing a prediction refinement of optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process, wherein the optical flow calculation also includes a padding operation applied to at least one of the PROF process or the BDOF process according to a rule to derive padding samples.

[0879] 11. A method according to clause 10, wherein, during the PROF process, one or more initial predictions are computed at sub-block level during affine motion compensated prediction and refined using optical flow computation.

[0880] 12. A method according to clause 10, wherein, during the BDOF process, one or more initial predictions are refined using at least one gradient value obtained during the optical flow computation.

[0881] 13. The method of clause 10, wherein the rules specify that the same fill operation be used for the PROF process and the BDOF process.

[0882] 14. The method of clause 10, wherein the rule specifies that padding samples are derived from integer samples at integer positions in a reference picture of the current video block.

[0883] 15. The method of clause 14, wherein the integer samples are located around padding samples having a difference of MV(Mvx, Mvy) rounded to an integer MV.

[0884] 16. The method of clause 14, wherein MV(Mvx, MvY) is rounded to the floor of an integer (IntX, IntY).

[0885] 17. The method of clause 14, wherein MV(Mvx, MvY) is rounded to the nearest integer MV(IntX, IntY).

[0886] 18. A method according to clause 14, wherein MV(Mvx, MvY) is rounded to an integer MV(IntX, IntY) such that IntX=SatShift(MvX, P) and IntY=SatShift(MvY, P), where P indicates the precision of MV, and

[0887]

[0888] 19. A method according to any of clauses 15 to 18, wherein the MV is rounded based on a precision of the MV that depends on the color format and / or color components of the current video block.

[0889] 20. A method according to clause 10, wherein information on how to perform the padding operation is signaled in a video parameter set (VPS), a decoding parameter set (DPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a slice header, a slice group header, a slice, a codec tree unit or a codec unit.

[0890] 21. The method of clause 10, wherein the information on how to perform the fill operation is in a profile, level or hierarchy of rules.

[0891] 22. The method of clause 10, wherein the information on how to perform the padding operation depends on the size of the current video block.

[0892] 23. A method according to any of clauses 10 to 22, wherein performing the conversion comprises generating a codec representation from the current video block.

[0893] 24. A method according to any of clauses 10 to 22, wherein performing the conversion comprises generating the current video block from a codec representation.

[0894] 25. An apparatus in a video system, comprising a processor and a non-transitory memory having instructions thereon, wherein the instructions, when executed by the processor, cause the processor to perform the method according to any one of clauses 10 to 22.

[0895] 26. A computer program product stored on a non-transitory computer readable medium, the computer program product comprising program code for performing the method according to any of clauses 10 to 22.

[0896] 27. A video encoding method, comprising: determining a final prediction block of the current video block by refining one or more initial predictions of the current video block based on motion gradients according to a precision rule to encode a current video block of a video into a codec representation of the video; and encoding the current video block into a codec representation using the final prediction block, wherein the optical flow calculation comprises a prediction refinement using optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process in which one or more initial predictions are calculated at a sub-block level and refined using optical flow calculation, and in which one or more initial predictions are refined using spatial and temporal gradients, wherein the precision rule specifies that the same precision is used to represent gradients for both the PROF process and the BDOF process.

[0897] 28. A video decoding method, comprising: determining a final prediction block of the current video block by refining one or more initial predictions of the current video block based on motion gradients according to a precision rule using optical flow calculations to decode a current video block of the video from a codec representation of the video; and generating a decoded current video block from the codec representation using the final prediction block, wherein the optical flow calculations include a prediction refinement using optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process in which one or more initial predictions are calculated at a sub-block level and refined using optical flow calculations, and in which one or more initial predictions are refined using spatial and temporal gradients, wherein the precision rule specifies that the same precision is used to represent gradients for both the PROF process and the BDOF process.

[0898] 29. A video encoding method, comprising: in order to encode a current video block of a video into a codec representation of the video, refining one or more initial predictions of the current video block using optical flow calculation, determining a final prediction block of the current video block; and encoding the current video block into a codec representation using the final prediction block, wherein the optical flow calculation includes a prediction refinement using optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process, in which the prediction refinement using optical flow (PROF) process one or more initial predictions are calculated at a sub-block level and refined using optical flow calculation, and in which the bidirectional optical flow (BDOF) process one or more initial predictions are refined using spatial and temporal gradients, wherein the optical flow calculation also includes a filling operation applied to at least one of the PROF process or the BDOF process according to a rule to derive filling samples.

[0899] 30. A video decoding method, comprising: in order to decode a current video block of a video from a codec representation of the video, refining one or more initial predictions of the current video block using optical flow calculation to determine a final prediction block of the current video block; and generating a decoded current video block from the codec representation using the final prediction block, wherein the optical flow calculation includes a prediction refinement using optical flow (PROF) process and / or a bidirectional optical flow (BDOF) process, in which the prediction refinement using optical flow (PROF) process one or more initial predictions are calculated at a sub-block level and refined using optical flow calculation, and in which the bidirectional optical flow (BDOF) process one or more initial predictions are refined using spatial and temporal gradients, wherein the optical flow calculation also includes a padding operation applied to at least one of the PROF process or the BDOF process according to a rule to derive padding samples.

[0900] From the foregoing it will be appreciated that specific embodiments of the presently disclosed technology have been described herein for purposes of illustration, but that various modifications may be made without departing from the scope of the invention. Accordingly, the presently disclosed technology is not to be limited except as set forth in the appended claims.

[0901] The embodiments of the subject matter and functional operations described in this patent document can be implemented in various systems, digital electronic circuits, or in computer software, firmware or hardware (including the structures disclosed in this specification and their structural equivalents), or in a combination of one or more of them. The embodiments of the subject matter described in this specification can be implemented as one or more computer program products, i.e., one or more modules of computer program instructions encoded on a tangible and non-temporary computer-readable medium, which are used to be executed by a data processing device or control the operation of the data processing device. The computer-readable medium can be a combination of a machine-readable storage device, a machine-readable storage substrate, a memory device, a material that affects a machine-readable propagation signal, or a combination of one or more of them. The term "data processing unit" or "data processing device" includes all devices, equipment and machines for processing data, including, for example, a programmable processor, a computer, or multiple processors or computers. In addition to hardware, the device can also include code that creates an execution environment for the computer program in question, for example, code that constitutes a processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.

[0902] A computer program (also known as a program, software, software application, script, or code) can be written in any form of programming language (including compiled or interpreted languages), and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program does not necessarily correspond to a file in a file system. A program may be stored in a portion of a file that holds other programs or data (e.g., one or more scripts stored in a markup language document), in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions). A computer program may be deployed to execute on one computer or on multiple computers located on one site or distributed across multiple sites and interconnected by a communication network.

[0903] The processes and logic flows described in this specification can be performed by one or more programmable processors executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows can also be performed by special purpose logic circuits, and the apparatus can also be implemented as special purpose logic circuits, such as FPGAs (Field Programmable Gate Arrays) or ASICs (Application Specific Integrated Circuits).

[0904] Processors suitable for executing computer programs include, for example, general-purpose and special-purpose microprocessors, and any one or more processors of any type of digital computer. Typically, the processor will receive instructions and data from a read-only memory or a random access memory or both. The basic elements of a computer are a processor for executing instructions and one or more memory devices for storing instructions and data. Typically, a computer will also include one or more large-capacity storage devices (e.g., magnetic disks, magneto-optical disks, or optical disks) for storing data, or be operably coupled to receive data from the one or more large-capacity storage devices or to transfer data to the one or more large-capacity storage devices, or to receive data from and transfer data to the one or more large-capacity storage devices. However, the computer does not need such a device. Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, for example, semiconductor memory devices, such as EPROM, EEPROM, and flash memory devices. Processors and memory can be supplemented by or incorporated into a dedicated logic circuit.

[0905] It is intended that the specification and drawings be considered exemplary only, where exemplary means example.As used herein, the use of "or" is intended to include "and / or" unless the context clearly dictates otherwise.

[0906] Although this patent document contains many details, these details should not be interpreted as limitations on any invention or the scope that may be claimed, but rather as descriptions of features specific to particular embodiments of particular inventions. Certain features described in the context of separate embodiments in this patent document may also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. In addition, although features may be described above as working in certain combinations and even initially claimed as such, one or more features from the claimed combination may be excluded from the combination in some cases, and the claimed combination may be directed to a sub-combination or a variation of the sub-combination.

[0907] Similarly, although operations are depicted in a particular order in the drawings, this should not be understood as requiring that such operations be performed in the particular order shown or in a sequential order, or that all of the operations shown be performed, to achieve the desired results. In addition, the separation of various system components in the embodiments described in this patent document should not be understood as requiring such separation in all embodiments.

[0908] Only a few implementations and examples are described, and other implementations, enhancements, and variations may be made based on what is described and shown in this patent document.

Claims

1. A video processing method, include: For a first video block of a video encoded and decoded in a non-affine mode, determining a first final prediction block for the first video block by refining one or more first initial predictions for the first video block using a first optical flow computation process, wherein each first initial prediction is refined based on at least one gradient of the each first initial prediction; performing a first conversion between the first video block and a bitstream of the video using the first final prediction block; For a second video block of the video encoded and decoded in an affine mode, determining a second final prediction block of the second video block by refining one or more second initial predictions of the second video block using a second optical flow calculation process, wherein each second initial prediction is refined based on at least one gradient of the each second initial prediction; as well as performing a second conversion between the second video block and a bitstream of the video using the second final prediction block; The gradient of the first optical flow calculation process and the gradient of the second optical flow calculation process have the same accuracy.

2. The method according to claim 1, in, The gradient of the first optical flow calculation process is calculated based on a first difference between a plurality of first initial prediction sample points; and The gradient of the second optical flow calculation process is calculated based on a second difference between a plurality of second initial prediction sample points.

3. The method according to claim 1, in, The first optical flow calculation process is only used for the bidirectional inter-frame prediction mode, and the second optical flow calculation process is used for the bidirectional inter-frame prediction mode and the unidirectional inter-frame prediction mode.

4. The method according to claim 2, in, The first difference and the second difference are respectively right-shifted by the same value to determine a gradient of the first optical flow calculation process and a gradient of the second optical flow calculation process.

5. The method according to claim 1, in, The horizontal and vertical gradients of each first initial prediction (x,y), denoted as gradientH and gradientV respectively, are calculated as one of the following: gradientH[x][y]=(predSamples[x+1][y]-predSample[x-1][y])>>Shift0, gradientV[x][y]=(predSample[x][y+1]-predSample[x][y-1])>>Shift1.

6. The method according to claim 1, in, The same padding operation is used for the reference block used to calculate the gradient of the first optical flow calculation process and the reference block used to calculate the gradient of the second optical flow calculation process.

7. The method according to claim 6, in, The reference block used to calculate the gradient of the first optical flow calculation process and the reference block used to calculate the gradient of the second optical flow calculation process are filled with integer sample points.

8. The method according to claim 7, in, A padding operation is used to derive an upper neighboring sample row, a lower neighboring sample row, a left neighboring sample column, and a right neighboring sample column of the reference block used to calculate the gradient of the first optical flow calculation process and the reference block used to calculate the gradient of the second optical flow calculation process, and wherein the padding operation is applied by excluding an 8-tap interpolation filtering process.

9. The method according to claim 1, in, The first optical flow calculation process is a bidirectional optical flow process, and the second optical flow calculation process is a prediction refinement process using optical flow.

10. The method according to claim 1, in, The first conversion includes encoding the first video block into the bitstream, and the second conversion includes encoding the second video block into the bitstream.

11. The method according to claim 1, in, The first conversion includes decoding the first video block from the bitstream, and the second conversion includes decoding the second video block from the bitstream.

12. An apparatus for processing video data, comprising a processor and a non-transitory memory having instructions thereon, wherein the instructions, when executed by the processor, cause the processor to: For a first video block of a video encoded and decoded in a non-affine mode, determining a first final prediction block for the first video block by refining one or more first initial predictions for the first video block using a first optical flow computation process, wherein each first initial prediction is refined based on at least one gradient of the each first initial prediction; performing a first conversion between the first video block and a bitstream of the video using the first final prediction block; For a second video block of the video encoded and decoded in an affine mode, determining a second final prediction block of the second video block by refining one or more second initial predictions of the second video block using a second optical flow calculation process, wherein each second initial prediction is refined based on at least one gradient of the each second initial prediction; as well as performing a second conversion between the second video block and a bitstream of the video using the second final prediction block; The gradient of the first optical flow calculation process and the gradient of the second optical flow calculation process have the same accuracy.

13. The device according to claim 12, in, The gradient of the first optical flow calculation process is calculated based on a first difference between a plurality of first initial prediction sample points; and The gradient of the second optical flow calculation process is calculated based on a second difference between a plurality of second initial prediction sample points.

14. The device according to claim 12, in, The first optical flow calculation process is only used for the bidirectional inter-frame prediction mode, and the second optical flow calculation process is used for the bidirectional inter-frame prediction mode and the unidirectional inter-frame prediction mode.

15. The device according to claim 13, in, The first difference and the second difference are respectively right-shifted by the same value to determine a gradient of the first optical flow calculation process and a gradient of the second optical flow calculation process.

16. The device according to claim 12, in, The horizontal and vertical gradients of each first initial prediction (x,y), denoted as gradientH and gradientV respectively, are calculated as one of the following: gradientH[x][y]=(predSamples[x+1][y]-predSample[x-1][y])>>Shift0, gradientV[x][y]=(predSample[x][y+1]-predSample[x][y-1])>>Shift1.

17. The device according to claim 12, in, The same padding operation is used for the reference block used to calculate the gradient of the first optical flow calculation process and the reference block used to calculate the gradient of the second optical flow calculation process.

18. The device according to claim 12, in, The reference block used to calculate the gradient of the first optical flow calculation process and the reference block used to calculate the gradient of the second optical flow calculation process are filled with integer sample points.

19. A non-transitory computer-readable storage medium storing instructions that cause a processor to: For a first video block of a video encoded and decoded in a non-affine mode, determining a first final prediction block for the first video block by refining one or more first initial predictions for the first video block using a first optical flow computation process, wherein each first initial prediction is refined based on at least one gradient of the each first initial prediction; performing a first conversion between the first video block and a bitstream of the video using the first final prediction block; For a second video block of the video encoded and decoded in an affine mode, determining a second final prediction block of the second video block by refining one or more second initial predictions of the second video block using a second optical flow calculation process, wherein each second initial prediction is refined based on at least one gradient of the each second initial prediction; as well as performing a second conversion between the second video block and a bitstream of the video using the second final prediction block; The gradient of the first optical flow calculation process and the gradient of the second optical flow calculation process have the same accuracy.

20. A non-transitory computer-readable recording medium storing a bit stream of a video generated by a method performed by a video processing device, wherein the method include: For a first video block of a video encoded and decoded in a non-affine mode, determining a first final prediction block for the first video block by refining one or more first initial predictions for the first video block using a first optical flow computation process, wherein each first initial prediction is refined using at least one gradient of the each first initial prediction; generating the bitstream based on the first final prediction block; for a second video block of the video encoded and decoded in affine mode, determining a second final prediction block of the second video block by refining one or more second initial predictions of the second video block using a second optical flow computation process, wherein each second initial prediction is refined using at least one gradient of the each second initial prediction; as well as generating the bitstream based on the second final prediction block; The gradient of the first optical flow calculation process and the gradient of the second optical flow calculation process have the same accuracy.

21. A method for storing a bit stream of a video, include: For a first video block of a video encoded and decoded in a non-affine mode, determining a first final prediction block for the first video block by refining one or more first initial predictions for the first video block using a first optical flow computation process, wherein each first initial prediction is refined using at least one gradient of the each first initial prediction; generating the bitstream based on the first final prediction block; for a second video block of the video encoded and decoded in affine mode, determining a second final prediction block of the second video block by refining one or more second initial predictions of the second video block using a second optical flow computation process, wherein each second initial prediction is refined using at least one gradient of the each second initial prediction; generating the bitstream based on the second final prediction block; as well as storing the bitstream in a non-transitory computer-readable recording medium, The gradient of the first optical flow calculation process and the gradient of the second optical flow calculation process have the same accuracy.