Patent Publication Number: US-11641483-B2

Title: Interaction between merge list construction and other tools

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
     This application is a continuation of International Patent Application No. PCT/CN2020/080597, filed on Mar. 23, 2020, which claims the priority to and benefits of U.S. Provisional Application No. 62/822,438, filed on Mar. 22, 2019. All of the aforementioned patent applications are hereby incorporated by reference in their entireties. 
    
    
     TECHNICAL FIELD 
     This patent document relates to video coding techniques, devices and systems. 
     BACKGROUND 
     In spite of the advances in video compression, digital video still accounts for the largest bandwidth use on the internet and other digital communication networks. As the number of connected user devices capable of receiving and displaying video increases, it is expected that the bandwidth demand for digital video usage will continue to grow. 
     SUMMARY 
     This document discloses methods, systems, and devices for encoding and decoding digital video based on the interaction between merge list construction and other video coding tools and methods. 
     In one example aspect, a method for video processing is disclosed. The method includes determining, based on a first threshold (T1), a maximum number of history-based motion vector prediction (HMVP) candidates to be checked in a table, making a decision regarding a selective checking of a number of the HMVP candidates in an order, the number of the HMVP candidates checked not exceeding the maximum number of HMVP candidates, constructing, based on the decision, a motion candidates list, and performing, based on the motion candidates list, a conversion between a current block and a bitstream representation of the current block. 
     In another example aspect, a method for video processing is disclosed. The method includes constructing a merge list comprising a plurality of allowed merge candidates, wherein a number of the plurality of allowed merge candidates for a current block is smaller than or equal to a maximum list size, and performing, based on the merge list, a conversion between the current block and a bitstream representation of the current block. 
     In yet another example aspect, a method for video processing is disclosed. The method includes constructing, based on a selective invocation of merge list construction process and a virtual candidate derivation process, a triangular merge list, and performing, based on the triangular merge list, a conversion between a current block and a bitstream representation of the current block, wherein the merge list construction process comprises constructing at least one of a spatial candidate, a temporal candidate, a history-based motion vector prediction (HMVP) candidate or a pairwise averaged candidate, and wherein the virtual candidate derivation process comprises directly copying motion information of one or more merge candidates. 
     In yet another example aspect, a video encoder device that implements a video encoding method described herein is disclosed. 
     In yet another representative aspect, the various techniques described herein may be embodied as a computer program product stored on a non-transitory computer readable media. The computer program product includes program code for carrying out the methods described herein. 
     In yet another representative aspect, a video decoder apparatus may implement a method as described herein. 
     The details of one or more implementations are set forth in the accompanying attachments, the drawings, and the description below. Other features will be apparent from the description and drawings, and from the claims. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG.  1    is a block diagram showing an example of a video encoder implementation 
         FIG.  2    illustrates macroblock partitioning in the H.264 video coding standard. 
         FIG.  3    illustrates an example of splitting coding blocks (CB) into prediction blocks. 
         FIG.  4    illustrates an example implementation for subdivision of a CTB into CBs and transform block (TBs). Solid lines indicate CB boundaries and dotted lines indicate TB boundaries, including an example CTB with its partitioning, and a corresponding quadtree. 
         FIG.  5    shows an example of a Quad Tree Binary Tree (QTBT) structure for partitioning video data. 
         FIG.  6    shows an example of video block partitioning. 
         FIG.  7    shows an example of quad-tree partitioning. 
         FIG.  8    shows an example of tree-type signaling. 
         FIG.  9    shows an example of a derivation process for merge candidate list construction. 
         FIG.  10    shows example positions of spatial merge candidates. 
         FIG.  11    shows examples of candidate pairs considered for redundancy check of spatial merge candidates. 
         FIG.  12    shows examples of positions for the second PU of N×2N and 2N×N partitions. 
         FIG.  13    illustrates motion vector scaling for temporal merge candidates. 
         FIG.  14    shows candidate positions for temporal merge candidates, and their co-located picture. 
         FIG.  15    shows an example of a combined bi-predictive merge candidate. 
         FIG.  16    shows an example of a derivation process for motion vector prediction candidates. 
         FIG.  17    shows an example of motion vector scaling for spatial motion vector candidates. 
         FIG.  18    shows an example Alternative Temporal Motion Vector Prediction (ATMVP) for motion prediction of a CU. 
         FIG.  19    pictorially depicts an example of identification of a source block and a source picture. 
         FIG.  20    shows an example of one CU with four sub-blocks and neighboring blocks. 
         FIG.  21    illustrates an example of bilateral matching. 
         FIG.  22    illustrates an example of template matching. 
         FIG.  23    depicts an example of unilateral Motion Estimation (ME) in Frame Rate Up Conversion (FRUC). 
         FIG.  24    shows an example of spatially neighboring blocks used to derive spatial merge candidates. 
         FIG.  25    is a block diagram of an example of a hardware platform for implementing a visual media decoding or a visual media encoding technique described in the present document. 
         FIG.  26    is a block diagram of an example video processing system in which disclosed techniques may be implemented. 
         FIG.  27    is a flowchart for an example method for video processing. 
         FIG.  28    is a flowchart for another example method for video processing. 
         FIG.  29    is a flowchart for yet another example method for video processing. 
     
    
    
     DETAILED DESCRIPTION 
     To improve compression ratio of video, researchers are continually looking for new techniques by which to encode video. 
     1. Introduction 
     The present document is related to video coding technologies. Specifically, it is related to motion information coding (such as merge mode, AMVP mode) in video coding. It may be applied to the existing video coding standard like HEVC, or the standard (Versatile Video Coding) to be finalized. It may be also applicable to future video coding standards or video codec. 
     Brief Discussion 
     Video coding standards have evolved primarily through the development of the well-known ITU-T and ISO/IEC standards. The ITU-T produced H.261 and H.263, ISO/IEC produced MPEG-1 and MPEG-4 Visual, and the two organizations jointly produced the H.262/MPEG-2 Video and H.264/MPEG-4 Advanced Video Coding (AVC) and H.265/HEVC standards. Since H.262, the video coding standards are based on the hybrid video coding structure wherein temporal prediction plus transform coding are utilized. An example of a typical HEVC encoder framework is depicted in  FIG.  1   . 
     2.1 Partition Structure 
     2.1.1 Partition Tree Structure in H.264/AVC 
     The core of the coding layer in previous standards was the macroblock, containing a 16×16 block of luma samples and, in the usual case of 4:2:0 color sampling, two corresponding 8×8 blocks of chroma samples. 
     An intra-coded block uses spatial prediction to exploit spatial correlation among pixels. Two partitions are defined: 16×16 and 4×4. 
     An inter-coded block uses temporal prediction, instead of spatial prediction, by estimating motion among pictures. Motion can be estimated independently for either 16×16 macroblock or any of its sub-macroblock partitions: 16×8, 8×16, 8×8, 8×4, 4×8, 4×4 (see  FIG.  2   ). Only one motion vector (MV) per sub-macroblock partition is allowed. 
     2.1.2 Partition Tree Structure in HEVC 
     In HEVC, a CTU is split into CUs by using a quadtree structure denoted as coding tree to adapt to various local characteristics. The decision whether to code a picture area using inter-picture (temporal) or intra-picture (spatial) prediction is made at the CU level. Each CU can be further split into one, two or four PUs according to the PU splitting type. Inside one PU, the same prediction process is applied and the relevant information is transmitted to the decoder on a PU basis. After obtaining the residual block by applying the prediction process based on the PU splitting type, a CU can be partitioned into transform units (TUs) according to another quadtree structure similar to the coding tree for the CU. One of key feature of the HEVC structure is that it has the multiple partition conceptions including CU, PU, and TU. 
     In the following, the various features involved in hybrid video coding using HEVC are highlighted as follows. 
     1) Coding tree units and coding tree block (CTB) structure: The analogous structure in HEVC is the coding tree unit (CTU), which has a size selected by the encoder and can be larger than a traditional macroblock. The CTU consists of a luma CTB and the corresponding chroma CTBs and syntax elements. The size L×L of a luma CTB can be chosen as L=16, 32, or 64 samples, with the larger sizes typically enabling better compression. HEVC then supports a partitioning of the CTBs into smaller blocks using a tree structure and quadtree-like signaling. 
     2) Coding units (CUs) and coding blocks (CBs): The quadtree syntax of the CTU specifies the size and positions of its luma and chroma CBs. The root of the quadtree is associated with the CTU. Hence, the size of the luma CTB is the largest supported size for a luma CB. The splitting of a CTU into luma and chroma CBs is signaled jointly. One luma CB and ordinarily two chroma CBs, together with associated syntax, form a coding unit (CU). A CTB may contain only one CU or may be split to form multiple CUs, and each CU has an associated partitioning into prediction units (PUs) and a tree of transform units (TUs). 
     3) Prediction units and prediction blocks (PBs): The decision whether to code a picture area using inter picture or intra picture prediction is made at the CU level. A PU partitioning structure has its root at the CU level. Depending on the basic prediction-type decision, the luma and chroma CBs can then be further split in size and predicted from luma and chroma prediction blocks (PBs). HEVC supports variable PB sizes from 64×64 down to 4×4 samples.  FIG.  3    shows examples of allowed PBs for a M×M CU. 
     4) TUs and transform blocks: The prediction residual is coded using block transforms. A TU tree structure has its root at the CU level. The luma CB residual may be identical to the luma transform block (TB) or may be further split into smaller luma TBs. The same applies to the chroma TBs. Integer basis functions similar to those of a discrete cosine transform (DCT) are defined for the square TB sizes 4×4, 8×8, 16×16, and 32×32. For the 4×4 transform of luma intra picture prediction residuals, an integer transform derived from a form of discrete sine transform (DST) is alternatively specified. 
       FIG.  4    shows an example of a subdivision of a CTB into CBs [and transform block (TBs)]. Solid lines indicate CB borders and dotted lines indicate TB borders. (a) CTB with its partitioning. (b) corresponding quadtree. 
     2.1.2.1 Tree-Structured Partitioning into Transform Blocks and Units 
     For residual coding, a CB can be recursively partitioned into transform blocks (TBs). The partitioning is signaled by a residual quadtree. Only square CB and TB partitioning is specified, where a block can be recursively split into quadrants, as illustrated in  FIG.  4   . For a given luma CB of size M×M, a flag signals whether it is split into four blocks of size M/2×M/2. If further splitting is possible, as signaled by a maximum depth of the residual quadtree indicated in the SPS, each quadrant is assigned a flag that indicates whether it is split into four quadrants. The leaf node blocks resulting from the residual quadtree are the transform blocks that are further processed by transform coding. The encoder indicates the maximum and minimum luma TB sizes that it will use. Splitting is implicit when the CB size is larger than the maximum TB size. Not splitting is implicit when splitting would result in a luma TB size smaller than the indicated minimum. The chroma TB size is half the luma TB size in each dimension, except when the luma TB size is 4×4, in which case a single 4×4 chroma TB is used for the region covered by four 4×4 luma TBs. In the case of intra-picture-predicted CUs, the decoded samples of the nearest-neighboring TBs (within or outside the CB) are used as reference data for intra picture prediction. 
     In contrast to previous standards, the HEVC design allows a TB to span across multiple PBs for inter-picture predicted CUs to maximize the potential coding efficiency benefits of the quadtree-structured TB partitioning. 
     2.1.2.2 Parent and Child Nodes 
     A CTB is divided according to a quad-tree structure, the nodes of which are coding units. The plurality of nodes in a quad-tree structure includes leaf nodes and non-leaf nodes. The leaf nodes have no child nodes in the tree structure (i.e., the leaf nodes are not further split). The, non-leaf nodes include a root node of the tree structure. The root node corresponds to an initial video block of the video data (e.g., a CTB). For each respective non-root node of the plurality of nodes, the respective non-root node corresponds to a video block that is a sub-block of a video block corresponding to a parent node in the tree structure of the respective non-root node. Each respective non-leaf node of the plurality of non-leaf nodes has one or more child nodes in the tree structure. 
     2.1.3 Quadtree Plus Binary Tree Block Structure with Larger CTUs in JEM 
     To explore the future video coding technologies beyond HEVC, Joint Video Exploration Team (JVET) was founded by VCEG and MPEG jointly in 2015. Since then, many new methods have been adopted by JVET and put into the reference software named Joint Exploration Model (JEM). 
     2.1.3.1 QTBT Block Partitioning Structure 
     Different from HEVC, the QTBT structure removes the concepts of multiple partition types, i.e. it removes the separation of the CU, PU and TU concepts, and supports more flexibility for CU partition shapes. In the QTBT block structure, a CU can have either a square or rectangular shape. As shown in  FIG.  5   , a coding tree unit (CTU) is first partitioned by a quadtree structure. The quadtree leaf nodes are further partitioned by a binary tree structure. There are two splitting types, symmetric horizontal splitting and symmetric vertical splitting, in the binary tree splitting. The binary tree leaf nodes are called coding units (CUs), and that segmentation is used for prediction and transform processing without any further partitioning. This means that the CU, PU and TU have the same block size in the QTBT coding block structure. In the JEM, a CU sometimes consists of coding blocks (CBs) of different colour components, e.g. one CU contains one luma CB and two chroma CBs in the case of P and B slices of the 4:2:0 chroma format and sometimes consists of a CB of a single component, e.g., one CU contains only one luma CB or just two chroma CBs in the case of I slices. 
     The following parameters are defined for the QTBT partitioning scheme.
         CTU size: the root node size of a quadtree, the same concept as in HEVC   MinQTSize: the minimally allowed quadtree leaf node size   MaxBTSize: the maximally allowed binary tree root node size   MaxBTDepth: the maximally allowed binary tree depth   MinBTSize: the minimally allowed binary tree leaf node size       

     In one example of the QTBT partitioning structure, the CTU size is set as 128×128 luma samples with two corresponding 64×64 blocks of chroma samples, the MinQTSize is set as 16×16, the MaxBTSize is set as 64×64, the MinBTSize (for both width and height) is set as 4×4, and the MaxBTDepth is set as 4. The quadtree partitioning is applied to the CTU first to generate quadtree leaf nodes. The quadtree leaf nodes may have a size from 16×16 (i.e., the MinQTSize) to 128×128 (i.e., the CTU size). If the leaf quadtree node is 128×128, it will not be further split by the binary tree since the size exceeds the MaxBTSize (i.e., 64×64). Otherwise, the leaf quadtree node could be further partitioned by the binary tree. Therefore, the quadtree leaf node is also the root node for the binary tree and it has the binary tree depth as 0. When the binary tree depth reaches MaxBTDepth (i.e., 4), no further splitting is considered. When the binary tree node has width equal to MinBTSize (i.e., 4), no further horizontal splitting is considered. Similarly, when the binary tree node has height equal to MinBTSize, no further vertical splitting is considered. The leaf nodes of the binary tree are further processed by prediction and transform processing without any further partitioning. In the JEM, the maximum CTU size is 256×256 luma samples. 
       FIG.  5    (left) illustrates an example of block partitioning by using QTBT, and  FIG.  5    (right) illustrates the corresponding tree representation. The solid lines indicate quadtree splitting and dotted lines indicate binary tree splitting. In each splitting (i.e., non-leaf) node of the binary tree, one flag is signalled to indicate which splitting type (i.e., horizontal or vertical) is used, where 0 indicates horizontal splitting and 1 indicates vertical splitting. For the quadtree splitting, there is no need to indicate the splitting type since quadtree splitting always splits a block both horizontally and vertically to produce 4 sub-blocks with an equal size. 
     In addition, the QTBT scheme supports the ability for the luma and chroma to have a separate QTBT structure. Currently, for P and B slices, the luma and chroma CTBs in one CTU share the same QTBT structure. However, for I slices, the luma CTB is partitioned into CUs by a QTBT structure, and the chroma CTBs are partitioned into chroma CUs by another QTBT structure. This means that a CU in an I slice consists of a coding block of the luma component or coding blocks of two chroma components, and a CU in a P or B slice consists of coding blocks of all three colour components. 
     In HEVC, inter prediction for small blocks is restricted to reduce the memory access of motion compensation, such that bi-prediction is not supported for 4×8 and 8×4 blocks, and inter prediction is not supported for 4×4 blocks. In the QTBT of the JEM, these restrictions are removed. 
     2.1.4 Ternary-Tree for VVC 
     As proposed in a previous implementation, tree types other than quad-tree and binary-tree are supported. In the implementation, two more ternary tree (TT) partitions, i.e., horizontal and vertical center-side ternary-trees are introduced, as shown in  FIGS.  6  ( d ) and ( e ) . 
       FIG.  6    shows: (a) quad-tree partitioning (b) vertical binary-tree partitioning (c) horizontal binary-tree partitioning (d) vertical center-side ternary-tree partitioning (e) horizontal center-side ternary-tree partitioning. 
     In the previous implementation, there are two levels of trees, region tree (quad-tree) and prediction tree (binary-tree or ternary-tree). A CTU is firstly partitioned by region tree (RT). A RT leaf may be further split with prediction tree (PT). A PT leaf may also be further split with PT until max PT depth is reached. A PT leaf is the basic coding unit. It is still called CU for convenience. A CU cannot be further split. Prediction and transform are both applied on CU in the same way as JEM. The whole partition structure is named ‘multiple-type-tree’. 
     2.1.5 Examples of a Partitioning Structure 
     The tree structure used in this response, called Multi-Tree Type (MTT), is a generalization of the QTBT. In QTBT, as shown in  FIG.  5   , a Coding Tree Unit (CTU) is firstly partitioned by a quad-tree structure. The quad-tree leaf nodes are further partitioned by a binary-tree structure. 
     The fundamental structure of MTT constitutes of two types of tree nodes: Region Tree (RT) and Prediction Tree (PT), supporting nine types of partitions, as shown in  FIG.  7   . 
       FIG.  7    shows: (a) quad-tree partitioning (b) vertical binary-tree partitioning (c) horizontal binary-tree partitioning (d) vertical ternary-tree partitioning (e) horizontal ternary-tree partitioning (f) horizontal-up asymmetric binary-tree partitioning (g) horizontal-down asymmetric binary-tree partitioning (h) vertical-left asymmetric binary-tree partitioning (i) vertical-right asymmetric binary-tree partitioning. 
     A region tree can recursively split a CTU into square blocks down to a 4×4 size region tree leaf node. At each node in a region tree, a prediction tree can be formed from one of three tree types: Binary Tree (BT), Ternary Tree (TT), and Asymmetric Binary Tree (ABT). In a PT split, it is prohibited to have a quadtree partition in branches of the prediction tree. As in JEM, the luma tree and the chroma tree are separated in I slices. The signaling methods for RT and PT are illustrated in  FIG.  8   . 
     2.2 Inter Prediction in HEVC/H.265 
     Each inter-predicted PU has motion parameters for one or two reference picture lists. Motion parameters include a motion vector and a reference picture index. Usage of one of the two reference picture lists may also be signalled using inter_pred_idc. Motion vectors may be explicitly coded as deltas relative to predictors, such a coding mode is called AMVP mode. 
     When a CU is coded with skip mode, one PU is associated with the CU, and there are no significant residual coefficients, no coded motion vector delta or reference picture index. A merge mode is specified whereby the motion parameters for the current PU are obtained from neighbouring PUs, including spatial and temporal candidates. The merge mode can be applied to any inter-predicted PU, not only for skip mode. The alternative to merge mode is the explicit transmission of motion parameters, where motion vector, corresponding reference picture index for each reference picture list and reference picture list usage are signaled explicitly per each PU. 
     When signaling indicates that one of the two reference picture lists is to be used, the PU is produced from one block of samples. This is referred to as ‘uni-prediction’. Uni-prediction is available both for P-slices and B-slices. 
     When signaling indicates that both of the reference picture lists are to be used, the PU is produced from two blocks of samples. This is referred to as ‘bi-prediction’. Bi-prediction is available for B-slices only. 
     The following text provides the details on the inter prediction modes specified in HEVC. The description will start with the merge mode. 
     2.2.1 Merge Mode 
     2.2.1.1 Derivation of Candidates for Merge Mode 
     When a PU is predicted using merge mode, an index pointing to an entry in the merge candidates list is parsed from the bitstream and used to retrieve the motion information. The construction of this list is specified in the HEVC standard and can be summarized according to the following sequence of steps:
         Step 1: Initial candidates derivation
           Step 1.1: Spatial candidates derivation   Step 1.2: Redundancy check for spatial candidates   Step 1.3: Temporal candidates derivation   
           Step 2: Additional candidates insertion
           Step 2.1: Creation of bi-predictive candidates   Step 2.2: Insertion of zero motion candidates   
               

     These steps are also schematically depicted in  FIG.  9   . For spatial merge candidate derivation, a maximum of four merge candidates are selected among candidates that are located in five different positions. For temporal merge candidate derivation, a maximum of one merge candidate is selected among two candidates. Since constant number of candidates for each PU is assumed at decoder, additional candidates are generated when the number of candidates does not reach to maximum number of merge candidate (MaxNumMergeCand) which is signaled in slice header. Since the number of candidates is constant, index of best merge candidate is encoded using truncated unary binarization (TU). If the size of CU is equal to 8, all the PUs of the current CU share a single merge candidate list, which is identical to the merge candidate list of the 2N×2N prediction unit. 
     In the following, the operations associated with the aforementioned steps are detailed. 
     2.2.1.2 Spatial Candidates Derivation 
     In the derivation of spatial merge candidates, a maximum of four merge candidates are selected among candidates located in the positions depicted in  FIG.  10   . The order of derivation is A 1 , B 1 , B 0 , A 0  and B 2 . Position B 2  is considered only when any PU of position A 1 , B 1 , B 0 , A 0  is not available (e.g. because it belongs to another slice or tile) or is intra coded. After candidate at position A 1  is added, the addition of the remaining candidates is subject to a redundancy check which ensures that candidates with same motion information are excluded from the list so that coding efficiency is improved. To reduce computational complexity, not all possible candidate pairs are considered in the mentioned redundancy check. Instead only the pairs linked with an arrow in  FIG.  11    are considered and a candidate is only added to the list if the corresponding candidate used for redundancy check has not the same motion information. Another source of duplicate motion information is the “second PU” associated with partitions different from 2N×2N. As an example,  FIG.  12    depicts the second PU for the case of N×2N and 2N×N, respectively. When the current PU is partitioned as N×2N, candidate at position A 1  is not considered for list construction. In fact, by adding this candidate will lead to two prediction units having the same motion information, which is redundant to just have one PU in a coding unit. Similarly, position B 1  is not considered when the current PU is partitioned as 2N×N. 
     2.2.1.3 Temporal Candidate Derivation 
     In this step, only one candidate is added to the list. Particularly, in the derivation of this temporal merge candidate, a scaled motion vector is derived based on co-located PU belonging to the picture which has the smallest POC difference with current picture within the given reference picture list. The reference picture list to be used for derivation of the co-located PU is explicitly signaled in the slice header. The scaled motion vector for temporal merge candidate is obtained as illustrated by the dashed line in  FIG.  13   , which is scaled from the motion vector of the co-located PU using the POC distances, tb and td, where tb is defined to be the POC difference between the reference picture of the current picture and the current picture and td is defined to be the POC difference between the reference picture of the co-located picture and the co-located picture. The reference picture index of temporal merge candidate is set equal to zero. A practical realization of the scaling process is described in the HEVC specification. For a B-slice, two motion vectors, one is for reference picture list 0 and the other is for reference picture list 1, are obtained and combined to make the bi-predictive merge candidate. Illustration of motion vector scaling for temporal merge candidate. 
     In the co-located PU (Y) belonging to the reference frame, the position for the temporal candidate is selected between candidates C 0  and C 1 , as depicted in  FIG.  14   . If PU at position C 0  is not available, is intra coded, or is outside of the current CTU, position C 1  is used. Otherwise, position C 0  is used in the derivation of the temporal merge candidate. 
     2.2.1.4 Additional Candidates Insertion 
     Besides spatio-temporal merge candidates, there are two additional types of merge candidates: combined bi-predictive merge candidate and zero merge candidate. Combined bi-predictive merge candidates are generated by utilizing spatio-temporal merge candidates. Combined bi-predictive merge candidate is used for B-Slice only. The combined bi-predictive candidates are generated by combining the first reference picture list motion parameters of an initial candidate with the second reference picture list motion parameters of another. If these two tuples provide different motion hypotheses, they will form a new bi-predictive candidate. As an example,  FIG.  15    depicts the case when two candidates in the original list (on the left), which have mvL0 and refIdxL0 or mvL1 and refIdxL1, are used to create a combined bi-predictive merge candidate added to the final list (on the right). There are numerous rules regarding the combinations which are considered to generate these additional merge candidates. 
     Zero motion candidates are inserted to fill the remaining entries in the merge candidates list and therefore hit the MaxNumMergeCand capacity. These candidates have zero spatial displacement and a reference picture index which starts from zero and increases every time a new zero motion candidate is added to the list. The number of reference frames used by these candidates is one and two for uni and bi-directional prediction, respectively. Finally, no redundancy check is performed on these candidates. 
     2.2.1.5 Motion Estimation Regions for Parallel Processing 
     To speed up the encoding process, motion estimation can be performed in parallel whereby the motion vectors for all prediction units inside a given region are derived simultaneously. The derivation of merge candidates from spatial neighborhood may interfere with parallel processing as one prediction unit cannot derive the motion parameters from an adjacent PU until its associated motion estimation is completed. To mitigate the trade-off between coding efficiency and processing latency, HEVC defines the motion estimation region (MER) whose size is signaled in the picture parameter set using the “log2_parallel_merge_level_minus2” syntax element. When a MER is defined, merge candidates falling in the same region are marked as unavailable and therefore not considered in the list construction. 
     7.3.2.3 Picture Parameter Set RBSP Syntax 
     7.3.2.3.1 General Picture Parameter Set RBSP Syntax 
                                     Descriptor                  pic_parameter_set_rbsp( ) {            pps_pic_parameter_set_id   ue (v)        pps_seq_parameter_set_id   ue (v)        dependent_slice_segments_enabled_flag    u (1)       ...            pps_scaling_list_data_present_flag    u (1)        if( pps_scaling_list_data_present_flag )             scaling_list_data( )            lists_modification_present_flag    u (1)        log2_parallel_merge_level_minus2   ue (v)        slice_segment_header_extension_present_flag    u (1)        pps_extension_present_flag    u (1)       ...            rbsp_trailing_bits( )           }                    
log2_parallel_merge_level_minus2 plus 2 specifies the value of the variable Log 2ParMrgLevel, which is used in the derivation process for luma motion vectors for merge mode as specified in clause 8.5.3.2.2 and the derivation process for spatial merging candidates as specified in clause 8.5.3.2.3. The value of log2_parallel_merge_level_minus2 shall be in the range of 0 to CtbLog2SizeY−2, inclusive.
 
The variable Log 2ParMrgLevel is derived as follows:
 
Log 2ParMrgLevel=log2_parallel_merge_level_minus2+2  (7-37)
 
NOTE 3—The value of Log 2ParMrgLevel indicates the built-in capability of parallel derivation of the merging candidate lists. For example, when Log 2ParMrgLevel is equal to 6, the merging candidate lists for all the prediction units (PUs) and coding units (CUs) contained in a 64×64 block can be derived in parallel.
 
     2.2.2 Motion Vector Prediction in AMVP Mode 
     Motion vector prediction exploits spatio-temporal correlation of motion vector with neighboring PUs, which is used for explicit transmission of motion parameters. It constructs a motion vector candidate list by firstly checking availability of left, above temporally neighboring PU positions, removing redundant candidates and adding zero vector to make the candidate list to be constant length. Then, the encoder can select the best predictor from the candidate list and transmit the corresponding index indicating the chosen candidate. Similarly with merge index signaling, the index of the best motion vector candidate is encoded using truncated unary. The maximum value to be encoded in this case is 2 (e.g.,  FIGS.  2  to  8   ). In the following sections, details about derivation process of motion vector prediction candidate are provided. 
     2.2.2.1 Derivation of Motion Vector Prediction Candidates 
       FIG.  16    summarizes derivation process for motion vector prediction candidate. 
     In motion vector prediction, two types of motion vector candidates are considered: spatial motion vector candidate and temporal motion vector candidate. For spatial motion vector candidate derivation, two motion vector candidates are eventually derived based on motion vectors of each PU located in five different positions as depicted in  FIG.  11   . 
     For temporal motion vector candidate derivation, one motion vector candidate is selected from two candidates, which are derived based on two different co-located positions. After the first list of spatio-temporal candidates is made, duplicated motion vector candidates in the list are removed. If the number of potential candidates is larger than two, motion vector candidates whose reference picture index within the associated reference picture list is larger than 1 are removed from the list. If the number of spatio-temporal motion vector candidates is smaller than two, additional zero motion vector candidates is added to the list. 
     2.2.2.2 Spatial Motion Vector Candidates 
     In the derivation of spatial motion vector candidates, a maximum of two candidates are considered among five potential candidates, which are derived from PUs located in positions as depicted in  FIG.  11   , those positions being the same as those of motion merge. The order of derivation for the left side of the current PU is defined as A 0 , A 1 , and scaled A 0 , scaled A 1 . The order of derivation for the above side of the current PU is defined as B 0 , B 1 , B 2 , scaled B 0 , scaled B 1 , scaled B 2 . For each side there are therefore four cases that can be used as motion vector candidate, with two cases not required to use spatial scaling, and two cases where spatial scaling is used. The four different cases are summarized as follows.
         No spatial scaling
           (1) Same reference picture list, and same reference picture index (same POC)   (2) Different reference picture list, but same reference picture (same POC)   
           Spatial scaling
           (3) Same reference picture list, but different reference picture (different POC)   (4) Different reference picture list, and different reference picture (different POC)   
               

     The no-spatial-scaling cases are checked first followed by the spatial scaling. Spatial scaling is considered when the POC is different between the reference picture of the neighboring PU and that of the current PU regardless of reference picture list. If all PUs of left candidates are not available or are intra coded, scaling for the above motion vector is allowed to help parallel derivation of left and above MV candidates. Otherwise, spatial scaling is not allowed for the above motion vector. 
     In a spatial scaling process, the motion vector of the neighboring PU is scaled in a similar manner as for temporal scaling, as depicted as  FIG.  17   . The main difference is that the reference picture list and index of current PU is given as input; the actual scaling process is the same as that of temporal scaling. 
     2.2.2.3 Temporal Motion Vector Candidates 
     Apart for the reference picture index derivation, all processes for the derivation of temporal merge candidates are the same as for the derivation of spatial motion vector candidates (see, e.g.,  FIG.  6   ). The reference picture index is signaled to the decoder. 
     2.2.2.4 Signaling of AMVP Information 
     For the AMVP mode, four parts may be signalled in the bitstream, i.e., prediction direction, reference index, MVD and my predictor candidate index. 
     Syntax Tables: 
                                     Descriptor                  prediction unit( x0, y0, nPbW, nPbH ) {            if( cu_skip_flag[ x0 ][ y0 ] ) {             if( MaxNumMergeCand &gt; 1 )              merge_idx[ x0 ][ y0 ]   ae (v)        }else { /* MODE_INTER */             merge_flag[ x0 ][ y0 ]   ae (v)         if( merge_flag[ x0 ][ y0 ] ) {              if( MaxNumMergeCand &gt; 1 )               merge_idx[ x0 ][ y0 ]   ae (v)         }else {              if( slice_type = = B )               inter_pred_idc[ x0 ][ y0 ]   ae (v)          if( inter_pred_idc[ x0 ][ y0 ] != PRED_L1 ) {               if( num_ref_idx_l0_active_minus1 &gt; 0 )                ref_idx_l0[ x0 ][ y0 ]   ae (v)           mvd_coding( x0, y0, 0 )               mvp_10_flag[ x0 ][ y0 ]   ae (v)          }              if( inter_pred_idc[ x0 ][ y0 ] != PRED_L0 ) {               if( num_ref_idx_l1_active_minus1 &gt; 0 )                ref_idx_l1[ x0 ][ y0 ]   ae (v)           if(_mvd_l1_zero_flag &amp;&amp; inter_pred_idc               [ x0 ][ y0 ] = = PRED_BI )           {                MvdL1[ x0 ][ y0 ][ 0 ] = 0                MvdL1[ x0 ][ y0 ][ 1 ] = 0               }else                mvd_coding( x0, y0, 1 )               mvp_l1_flag[ x0 ][ y0 ]   ae (v)          }             }            }           }                    
7.3.8.9 Motion Vector Difference Syntax
 
     
       
         
           
               
               
             
               
                   
               
               
                   
                 Descriptor 
               
               
                   
               
             
            
               
                 mvd_coding( x0, y0, refList ) { 
                   
               
               
                  abs_mvd_greater0_flag[ 0 ] 
                 ae (v) 
               
               
                  abs_mvd_greater0_flag[ 1 ] 
                 ae (v) 
               
               
                  if( abs_mvd_greater0_flag[ 0 ] ) 
                   
               
               
                   abs_mvd_greater1_flag[ 0 ] 
                 ae (v) 
               
               
                  if( abs_mvd_greater0_flag[ 1 ] ) 
                   
               
               
                   abs_mvd_greater1_flag[ 1 ] 
                 ae (v) 
               
               
                  if( abs_mvd_greater0_flag[ 0 ] ) { 
                   
               
               
                   if( abs_mvd_greater1_flag[ 0 ] ) 
                   
               
               
                    abs_mvd_minus2[ 0 ] 
                 ae (v) 
               
               
                   mvd_sign_flag[ 0 ] 
                 ae (v) 
               
               
                  } 
                   
               
               
                  if( abs_mvd_greater0_flag[ 1 ] ) { 
                   
               
               
                   if( abs_mvd_greater1_flag[ 1 ] ) 
                   
               
               
                    abs_mvd_minus2[ 1 ] 
                 ae (v) 
               
               
                   mvd_sign_flag[ 1 ] 
                 ae (v) 
               
               
                  } 
                   
               
               
                 } 
               
               
                   
               
            
           
         
       
     
     2.3 New Inter Prediction Methods in JEM (Joint Exploration Model) 
     2.3.1 Sub-CU Based Motion Vector Prediction 
     In the JEM with QTBT, each CU can have at most one set of motion parameters for each prediction direction. Two sub-CU level motion vector prediction methods are considered in the encoder by splitting a large CU into sub-CUs and deriving motion information for all the sub-CUs of the large CU. Alternative temporal motion vector prediction (ATMVP) method allows each CU to fetch multiple sets of motion information from multiple blocks smaller than the current CU in the collocated reference picture. In spatial-temporal motion vector prediction (STMVP) method motion vectors of the sub-CUs are derived recursively by using the temporal motion vector predictor and spatial neighbouring motion vector. 
     To preserve more accurate motion field for sub-CU motion prediction, the motion compression for the reference frames is currently disabled. 
     2.3.1.1 Alternative Temporal Motion Vector Prediction 
     In the alternative temporal motion vector prediction (ATMVP) method, the motion vectors temporal motion vector prediction (TMVP) is modified by fetching multiple sets of motion information (including motion vectors and reference indices) from blocks smaller than the current CU. As shown in  FIG.  18   , the sub-CUs are square N×N blocks (N is set to 4 by default). 
     ATMVP predicts the motion vectors of the sub-CUs within a CU in two steps. The first step is to identify the corresponding block in a reference picture with a so-called temporal vector. The reference picture is called the motion source picture. The second step is to split the current CU into sub-CUs and obtain the motion vectors as well as the reference indices of each sub-CU from the block corresponding to each sub-CU, as shown in  FIG.  18   . 
     In the first step, a reference picture and the corresponding block is determined by the motion information of the spatial neighbouring blocks of the current CU. To avoid the repetitive scanning process of neighbouring blocks, the first merge candidate in the merge candidate list of the current CU is used. The first available motion vector as well as its associated reference index are set to be the temporal vector and the index to the motion source picture. This way, in ATMVP, the corresponding block may be more accurately identified, compared with TMVP, wherein the corresponding block (sometimes called collocated block) is always in a bottom-right or center position relative to the current CU. In one example, if the first merge candidate is from the left neighboring block (i.e., A 1  in  FIG.  19   ), the associated MV and reference picture are utilized to identify the source block and source picture. 
       FIG.  19    shows an example of the identification of source block and source picture 
     In the second step, a corresponding block of the sub-CU is identified by the temporal vector in the motion source picture, by adding to the coordinate of the current CU the temporal vector. For each sub-CU, the motion information of its corresponding block (the smallest motion grid that covers the center sample) is used to derive the motion information for the sub-CU. After the motion information of a corresponding N×N block is identified, it is converted to the motion vectors and reference indices of the current sub-CU, in the same way as TMVP of HEVC, wherein motion scaling and other procedures apply. For example, the decoder checks whether the low-delay condition (i.e. the POCs of all reference pictures of the current picture are smaller than the POC of the current picture) is fulfilled and possibly uses motion vector MV x  (the motion vector corresponding to reference picture list X) to predict motion vector MV y  (with X being equal to 0 or 1 and Y being equal to 1−X) for each sub-CU. 
     2.3.1.2 Spatial-Temporal Motion Vector Prediction 
     In this method, the motion vectors of the sub-CUs are derived recursively, following raster scan order.  FIG.  20    illustrates this concept. Let us consider an 8×8 CU which contains four 4×4 sub-CUs A, B, C, and D. The neighbouring 4×4 blocks in the current frame are labelled as a, b, c, and d. 
     The motion derivation for sub-CU A starts by identifying its two spatial neighbours. The first neighbour is the N×N block above sub-CU A (block c). If this block c is not available or is intra coded the other N×N blocks above sub-CU A are checked (from left to right, starting at block c). The second neighbour is a block to the left of the sub-CU A (block b). If block b is not available or is intra coded other blocks to the left of sub-CU A are checked (from top to bottom, staring at block b). The motion information obtained from the neighbouring blocks for each list is scaled to the first reference frame for a given list. Next, temporal motion vector predictor (TMVP) of sub-block A is derived by following the same procedure of TMVP derivation as specified in HEVC. The motion information of the collocated block at location D is fetched and scaled accordingly. Finally, after retrieving and scaling the motion information, all available motion vectors (up to 3) are averaged separately for each reference list. The averaged motion vector is assigned as the motion vector of the current sub-CU. 
       FIG.  20    shows an example of one CU with four sub-blocks (A-D) and its neighbouring blocks (a-d). 
     2.3.1.3 Sub-CU Motion Prediction Mode Signalling 
     The sub-CU modes are enabled as additional merge candidates and there is no additional syntax element required to signal the modes. Two additional merge candidates are added to merge candidates list of each CU to represent the ATMVP mode and STMVP mode. Up to seven merge candidates are used, if the sequence parameter set indicates that ATMVP and STMVP are enabled. The encoding logic of the additional merge candidates is the same as for the merge candidates in the HM, which means, for each CU in P or B slice, two more RD checks is needed for the two additional merge candidates. 
     In the JEM, all bins of merge index is context coded by CABAC. While in HEVC, only the first bin is context coded and the remaining bins are context by-pass coded. 
     2.3.2 Adaptive Motion Vector Difference Resolution 
     In HEVC, motion vector differences (MVDs) (between the motion vector and predicted motion vector of a PU) are signalled in units of quarter luma samples when use_integer_mv_flag is equal to 0 in the slice header. In the JEM, a locally adaptive motion vector resolution (LAMVR) is introduced. In the JEM, MVD can be coded in units of quarter luma samples, integer luma samples or four luma samples. The MVD resolution is controlled at the coding unit (CU) level, and MVD resolution flags are conditionally signalled for each CU that has at least one non-zero MVD components. 
     For a CU that has at least one non-zero MVD components, a first flag is signalled 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 signalled to indicate whether integer luma sample MV precision or four luma sample MV precision is used. 
     When the first MVD resolution flag of a CU is zero, or not coded for a CU (meaning all MVDs in the CU are zero), the quarter luma sample MV resolution is used for the CU. When a CU uses integer-luma sample MV precision or four-luma-sample MV precision, the MVPs in the AMVP candidate list for the CU are rounded to the corresponding precision. 
     In the encoder, CU-level RD checks are used to determine which MVD resolution is to be used for a CU. That is, the CU-level RD check is performed three times for each MVD resolution. To accelerate encoder speed, the following encoding schemes are applied in the JEM. 
     During RD check of a CU with normal quarter luma sample MVD resolution, the motion information of the current CU (integer luma sample accuracy) is stored. The stored motion information (after rounding) is used as the starting point for further small range motion vector refinement during the 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 duplicated three times. 
     RD check of a CU with 4 luma sample MVD resolution is conditionally invoked. For a CU, when RD cost integer luma sample MVD resolution is much larger than that of quarter luma sample MVD resolution, the RD check of 4 luma sample MVD resolution for the CU is skipped. 
     2.3.3 Pattern Matched Motion Vector Derivation 
     Pattern matched motion vector derivation (PMMVD) mode is a special merge mode based on Frame-Rate Up Conversion (FRUC) techniques. With this mode, motion information of a block is not signalled but derived at decoder side. 
     A FRUC flag is signalled for a CU when its merge flag is true. When the FRUC flag is false, a merge index is signalled and the regular merge mode is used. When the FRUC flag is true, an additional FRUC mode flag is signalled to indicate which method (bilateral matching or template matching) is to be used to derive motion information for the block. 
     At encoder side, the decision on whether using FRUC merge mode for a CU is based on RD cost selection as done for normal merge candidate. That is the two matching modes (bilateral matching and template matching) are both checked for a CU by using RD cost selection. The one leading to the minimal cost is further compared to other CU modes. If a FRUC matching mode is the most efficient one, FRUC flag is set to true for the CU and the related matching mode is used. 
     Motion derivation process in FRUC merge mode has two steps. A CU-level motion search is first performed, then followed by a Sub-CU level motion refinement. At CU level, an initial motion vector is derived for the whole CU based on bilateral matching or template matching. First, a list of MV candidates is generated and the candidate which leads to 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 around the starting point is performed and the MV results in the minimum matching cost is taken as the MV for the whole CU. Subsequently, the motion information is further refined at sub-CU level with the derived CU motion vectors as the starting points. 
     For example, the following derivation process is performed for a W×H CU motion information derivation. At the first stage, MV for the whole W×H CU is derived. At the second stage, the CU is further split into M×M sub-CUs. The value of M is calculated as in (16), D is a predefined splitting depth which is set to 3 by default in the JEM. Then the MV for each sub-CU is derived. 
     
       
         
           
             
               
                 
                   M 
                   = 
                   
                     max 
                     ⁢ 
                     
                       { 
                       
                         4 
                         , 
                         
                           min 
                           ⁢ 
                           
                             { 
                             
                               
                                 M 
                                 
                                   2 
                                   D 
                                 
                               
                               , 
                               
                                 N 
                                 
                                   2 
                                   D 
                                 
                               
                             
                             } 
                           
                         
                       
                       } 
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
     As shown in the  FIG.  21   , the 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 in two different reference pictures. Under the assumption of continuous motion trajectory, the motion vectors MV0 and MV1 pointing to the two reference blocks shall be proportional to the temporal distances, i.e., TD0 and TD1, between the current picture and the two reference pictures. As a special case, when the current picture is temporally between the two reference pictures and the temporal distance from the current picture to the two reference pictures is the same, the bilateral matching becomes mirror based bi-directional MV. 
     As shown in  FIG.  22   , template matching is used to derive motion information of the current CU by finding the closest match between a template (top and/or left neighbouring blocks of the current CU) in the current picture and a block (same size to the template) in a reference picture. Except the aforementioned FRUC merge mode, the template matching is also applied to AMVP mode. In the JEM, as done in HEVC, AMVP has two candidates. With template matching method, a new candidate is derived. If the newly derived candidate by template matching is different to 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 two (meaning remove the second existing AMVP candidate). When applied to AMVP mode, only CU level search is applied. 
     2.3.3.1 CU Level MV Candidate Set 
     The MV candidate set at CU level consists of: 
     (i) Original AMVP candidates if the current CU is in AMVP mode 
     (ii) all merge candidates, 
     (iii) several MVs in the interpolated MV field. 
     (iv) top and left neighbouring motion vectors 
     When using bilateral matching, each valid MV of a merge candidate is used as an input to generate a MV pair with the assumption of bilateral matching. For example, one valid MV of a merge candidate is (MVa, refa) at reference list A. Then the reference picture refb of its paired bilateral MV is found in the other reference list B so that refa and refb are temporally at different sides of the current picture. If such a refb is not available in reference list B, refb is determined as a reference which is different from refa and its temporal distance to the current picture is the minimal one in list B. After refb is determined, MVb is derived by scaling MVa based on the temporal distance between the current picture and refa, refb. 
     Four MVs from the interpolated MV field are also added to the CU level candidate list. More specifically, the interpolated MVs at the position (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 candidates are also added to CU level MV candidate set. 
     At the CU level, up to 15 MVs for AMVP CUs and up to 13 MVs for merge CUs are added to the candidate list. 
     2.3.3.2 Sub-CU Level MV Candidate Set 
     The MV candidate set at sub-CU level consists of: 
     (i) an MV determined from a CU-level search, 
     (ii) top, left, top-left and top-right neighbouring MVs, 
     (iii) scaled versions of collocated MVs from reference pictures, 
     (iv) up to 4 ATMVP candidates, 
     (v) up to 4 STMVP candidates 
     The scaled MVs from reference pictures are derived as follows. All the reference pictures in both lists are traversed. The MVs at a collocated position of the sub-CU in a reference picture are scaled to the reference of the starting CU-level MV. 
     ATMVP and STMVP candidates are limited to the four first ones. 
     At the sub-CU level, up to 17 MVs are added to the candidate list. 
     2.3.3.3 Generation of Interpolated MV Field 
     Before coding a frame, interpolated motion field is generated for the whole picture based on unilateral ME. Then the motion field may be used later as CU level or sub-CU level MV candidates. 
     First, the motion field of each reference pictures in both reference lists is traversed at 4×4 block level. For each 4×4 block, if the motion associated to the block passing through a 4×4 block in the current picture (as shown in  FIG.  23   ) and the block has not been assigned any interpolated motion, the motion of the reference block is scaled to the current picture according to the temporal distance TD0 and TD1 (the same way as that of 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 a 4×4 block, the block&#39;s motion is marked as unavailable in the interpolated motion field. 
     2.3.3.4 Interpolation and Matching Cost 
     When a motion vector points to a fractional sample position, motion compensated interpolation is needed. To reduce complexity, bi-linear interpolation instead of regular 8-tap HEVC interpolation is used for both bilateral matching and template matching. 
     The calculation of matching cost is a bit different at different steps. When selecting the candidate from the candidate set at the CU level, the matching cost is the absolute sum difference (SAD) of bilateral matching or template matching. After the starting MV is determined, the matching cost C of bilateral matching at sub-CU level search is calculated as follows:
 
 C =SAD+ w ·(|MV x −MV x   s |+|MV y −MV y   s |)  (2)
 
     where w is a weighting factor which is empirically set to 4, MV and MV s  indicate the current MV and the starting MV, respectively. SAD is still used as the matching cost of template matching at sub-CU level search. 
     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 MV is decided, final MC is performed using 8-taps interpolation filter for luma and 4-taps interpolation filter for chroma. 
     2.3.3.5 MV Refinement 
     MV refinement is a pattern based MV search with the criterion of bilateral matching cost or template matching cost. In the JEM, two search patterns are supported—an unrestricted center-biased diamond search (UCBDS) and an adaptive cross search for MV refinement at the CU level and sub-CU level, respectively. For both CU and sub-CU level MV refinement, the MV is directly searched at quarter luma sample MV accuracy, and this is followed by one-eighth luma sample MV refinement. The search range of MV refinement for the CU and sub-CU step are set equal to 8 luma samples. 
     2.3.3.6 Selection of Prediction Direction in Template Matching FRUC Merge Mode 
     In the bilateral matching merge mode, bi-prediction is always applied since the motion information of a CU is derived based on the closest match between two blocks along the motion trajectory of the current CU in two different reference pictures. There is no such limitation for the template matching merge mode. In the template matching merge mode, the encoder can choose among uni-prediction from list0, uni-prediction from list1 or bi-prediction for a CU. The selection is based on a template matching cost as follows:
         If costBi&lt;=factor*min (cost0, cost1)
           bi-prediction is used;   
           Otherwise, if cost0&lt;=cost1
           uni-prediction from list0 is used;   
           Otherwise,
           uni-prediction from list1 is used;   
               

     where cost0 is the SAD of list0 template matching, cost1 is the SAD of list1 template matching and costBi is the SAD of bi-prediction template matching. The value of factor is equal to 1.25, which means that the selection process is biased toward bi-prediction. The inter prediction direction selection is only applied to the CU-level template matching process. 
     2.3.4 Merge/Skip Mode with Bilateral Matching Refinement [8] 
     A merge candidate list is first constructed by inserting the motion vectors and reference indices of the spatial neighboring and temporal neighboring blocks into the candidate list with redundancy checking until the number of the available candidates reaches the maximum candidate size of 19. The merge candidate list for the merge/skip mode is constructed by inserting spatial candidates ( FIG.  11   ), temporal candidates, affine candidates, advanced temporal MVP (ATMVP) candidate, spatial temporal MVP (STMVP) candidate and the additional candidates as used in HEVC (Combined candidates and Zero candidates) according to a pre-defined insertion order:
         Spatial candidates for blocks 1-4.   Extrapolated affine candidates for blocks 1-4.   ATMVP.   STMVP.   Virtual affine candidate.   Spatial candidate (block 5) (used only when the number of the available candidates is smaller than 6).   Extrapolated affine candidate (block 5).   Temporal candidate (derived as in HEVC).   Non-adjacent spatial candidates followed by extrapolated affine candidate (blocks 6 to 49, as depicted in  FIG.  24   ).   Combined candidates.   Zero candidates       

     It is noted that IC flags are also inherited from merge candidates except for STMVP and affine. Moreover, for the first four spatial candidates, the bi-prediction ones are inserted before the ones with uni-prediction. 
     In [8], blocks which are not connected with the current block may be accessed. If a non-adjacent block is coded with non-intra mode, the associated motion information may be added as an additional merge candidate. 
     2.3.5 Shared Merge List JVET-M0170 
     It proposes to share the same merging candidate list for all leaf coding units (CUs) of one ancestor node in the CU split tree for enabling parallel processing of small skip/merge-coded CUs. The ancestor node is named merge sharing node. The shared merging candidate list is generated at the merge sharing node pretending the merge sharing node is a leaf CU. 
     For Type-2 definition, the merge sharing node will be decided for each CU inside a CTU during parsing stage of decoding; moreover, the merge sharing node is an ancestor node of leaf CU which must satisfy the following 2 criteria: 
     The merge sharing node size is equal to or larger than the size threshold 
     In the merge sharing node, one of the child CU size is smaller than the size threshold 
     Moreover, no samples of the merge sharing node are outside the picture boundary has to be guaranteed. During parsing stage, if an ancestor node satisfies the criteria (1) and (2) but has some samples outside the picture boundary, this ancestor node will not be the merge sharing node and it proceeds to find the merge sharing node for its child CUs. 
     JVET-M0170 describes an example for the difference of Type-1 and Type-2 definition. In this example, the parent node is ternary-split into 3 child CUs. The size of parent node is 128. For Type-1 definition, the 3 child-CUs will be merge sharing nodes separately. But for Type-2 definition, the parent node is the merge sharing node. 
     The proposed shared merging candidate list algorithm supports translational merge (including merge mode and triangle merge mode, history-based candidate is also supported) and subblock-based merge mode. For all kinds of merge mode, the behavior of shared merging candidate list algorithm looks basically the same, and it just generates candidates at the merge sharing node pretending the merge sharing node is a leaf CU. It has 2 major benefits. The first benefit is to enable parallel processing for merge mode, and the second benefit is to share all computations of all leaf CUs into the merge sharing node. Therefore, it significantly reduces the hardware cost of all merge modes for hardware codec. By the proposed shared merging candidate list algorithm, the encoder and decoder can easily support parallel encoding for merge mode and it relieves the cycle budget problem of merge mode. 
     2.3.6 Tile Groups 
     JVET-L0686 was adopted in which slices are removed in favor of tile groups and the HEVC syntax element slice_address is substituted with tile_group_address in the tile_group_header (if there is more than one tile in the picture) as address of the first tile in the tile group. 
     3. Examples of Problems Addressed by Embodiments Disclosed Herein 
     The current HEVC design could take the correlation of current block its neighbouring blocks (next to the current block) to better code the motion information. However, it is possible that that the neighbouring blocks correspond to different objects with different motion trajectories. In this case, prediction from its neighbouring blocks is not efficient. 
     Prediction from motion information of non-adjacent blocks could bring additional coding gain with the cost of storing all the motion information (typically on 4×4 level) into cache which significantly increase the complexity for hardware implementation. 
     4. Some Examples 
     To overcome the drawbacks of existing implementations, LUT-based motion vector prediction techniques using one or more look up tables with at least one motion candidate stored to predict motion information of a block can be implemented in various embodiments to provide video coding with higher coding efficiencies. Each LUT can include one or more motion candidates, each associated with corresponding motion information. Motion information of a motion candidate can include partial or all of the prediction direction, reference indices/pictures, motion vectors, LIC flags, affine flags, Motion Vector Derivation (MVD) precisions, and/or MVD values. Motion information may further include the block position information to indicate wherein the motion information is coming from. 
     The LUT-based motion vector prediction based on the disclosed technology, which may enhance both existing and future video coding standards, is elucidated in the following examples described for various implementations. Because the LUTs allow the encoding/decoding process to be performed based on historical data (e.g., the blocks that have been processed), the LUT-based motion vector prediction can also be referred to as History-based Motion Vector Prediction (HMVP) method. In the LUT-based motion vector prediction method, one or multiple tables with motion information from previously coded blocks are maintained during the encoding/decoding process. These motion candidates stored in the LUTs are named HMVP candidates. During the encoding/decoding of one block, the associated motion information in LUTs may be added to the motion candidate lists, and after encoding/decoding one block, LUTs may be updated. The updated LUTs are then used to code the subsequent blocks. The examples below should be considered as examples to explain general concepts. These examples should not be interpreted in a narrow way. Furthermore, these examples can be combined in any manner. 
     Some embodiments may use one or more look up tables with at least one motion candidate stored to predict motion information of a block. Embodiments may use motion candidate to indicate a set of motion information stored in a look up table. For conventional AMVP or merge modes, embodiments may use AMVP or merge candidates for storing the motion information. 
     The examples below explain general concepts. 
     Usage of Look Up Tables
     1. The checking order of motion candidates in a look up table (e.g., HMVP candidates in a HMVP table) is defined as follows (suppose K≥1) motion candidates are allowed to be checked):
       a. In one example, maximum number of motion candidates in a look up table (e.g., HMVP candidates in a look up table) to be checked (i.e., which may be added to the merge/AMVP candidate list) may depend on a variable.
           i. In one example, the variable is pre-defined, such as 5.   ii. In one example, when the number of available motion candidates (such as after pruning) is smaller than the value of the variable before checking the HMVP candidates from LUTs, one or multiple motion candidates (e.g., HMVP candidates) in a look up table may be checked in order.   iii. In one example, when the number of available motion candidates (such as after pruning) is no smaller than the value of the variable, none of the motion candidates in a look up table (e.g., HMVP candidates) may be checked in order.   
           b. The checking order of different look up tables is defined in usage of look up tables in the next subsection.   c. The checking process of HMVP candidates will terminate once the merge/AMVP candidate list reaches the maximumly allowed candidate numbers of the list.   d. The checking process of HMVP candidates will terminate once the merge/AMVP candidate list reaches the maximumly allowed candidate numbers of the list minus a threshold (Th). In one example, Th may be pre-defined as a positive integer value, e.g., 1, or 2, or 3. Alternatively, Th may be adaptively changed from block to block. Alternatively, Th may be signaled in the SPS/PPS/slice header etc. Alternatively, Th may further depend on block shape/block size/coded modes etc. Alternatively, Th may depend on how many available candidates before adding the motion candidates from LUTs.   e. Alternatively, the checking process of HMVP candidates will terminate once the number of added motion candidates reaches the maximumly allowed motion candidate numbers. The maximumly allowed motion candidate numbers for the motion candidate list may be signaled or pre-defined. Alternatively, the maximumly allowed motion candidate numbers may further depend on block shape/block size/coded modes etc. al.   
       

     Update of Look Up Tables
     2. It is proposed that the merge list may be always constructed till a given number of allowed value (denoted by MaxNumConstructedListSize), while the number of allowed merge candidates may be smaller than the MaxNumConstructedListSize.
       a. In one example, MaxNumConstructedListSize is set of 6.   b. In one example, indication of the number of allowed merge candidates may be signaled to the decoder, such as in SPS/slice header/picture header/tile group header/video data units.   c. Alternatively, furthermore, the number of allowed merge candidates (e.g., MaxNumMergeCand in the VVC specification) controls the parsing of merge index, but it is decoupled from how many merge candidates shall be constructed in the merge list.
           i. For example, the merge candidate list is always constructed with a fixed size such as MaxNumConstructedListSize, no matter what number of the allowed merge candidates is.   
           d. In one example, whether to invoke the process of HMVP candidate derivation process may depend on the number of available merge candidates and a given threshold, such as 5.
           i. For example, the process of HMVP candidate derivation process is not invoked if the number of available merge candidates is no smaller than the given threshold.   
           e. In one example, whether to invoke the process of pairwise averaged candidate derivation process may depend on a given threshold, such as 6.
           i. For example, the process of pairwise averaged candidate derivation process is not invoked if the number of available merge candidates is no smaller than the given threshold.   
           f. In one example, whether to stop the process of zero motion candidate derivation process may depend on a given threshold, such as 6.
           i. For example, the process of zero candidate derivation process is not invoked if the number of available merge candidates is no smaller than the given threshold.   
           g. In one example, the merge list may refer to the regular merge list, sub-block merge list, IBC merge list, triangular merge list.   
       3. The triangular merge list construction process may include two steps: 1) invoking the regular merge list construction process and 2) virtual candidate derivation process.
       a. In one example, the whole regular merge list construction process may be invoked.   b. Alternatively, partial of the regular merge list construction process (such as just invoking the process of spatial/temporal/HMVP/pairwise average candidate) may be invoked.   c. In one example, virtual candidate derivation process may be invoked when the number of available regular merge candidates is smaller than the maximum allowed TPM candidates.   d. In one example, the virtual candidates may be derived using techniques described in PCT/CN2018/115183, PCT/CN2019/075856, and PCT/CN2019/079061, all of which are incorporated by reference herein.   
       

     Additional Example Embodiments 
     Example Embodiment #1 
     In this embodiment, whether to invoke the process of HMVP candidate derivation process may depend on the number of available merge candidates and a given threshold (e.g., setting the threshold to be 5 in the example below). 
     In addition, whether to stop the process of zero motion candidate derivation process may depend on a given threshold (e.g., setting the threshold to be 5 in the example below). 
     This example embodiment relates to an implementation of some of the disclosed techniques in the context of the VVC codec. This sub-section shows how the current version of the codec standard may be modified for an example implementation. In this sub-section, the section and equation numbers refer to the corresponding section and equation numbers in the current release of the VVC video coding standard. 
     Further note that deletions are denoted by bolded double square brackets, e.g., [[a]] indicates that “a” is being deleted, and newly added text is bolded underlined text. 
     8.5.2.2 Derivation Process for Luma Motion Vectors for Merge Mode 
     This process is only invoked when merge_flag[xCb][yPb] is equal to 1, where (xCb, yCb) specify the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture. 
     Inputs to this process are: 
     
         
         
           
             a luma location (xCb, yCb) of the top-left sample of the current luma coding block relative to the top-left luma sample of the current picture, 
             a variable cbWidth specifying the width of the current coding block in luma samples, 
             a variable cbHeight specifying the height of the current coding block in luma samples. Outputs of this process are: 
             the luma motion vectors in 1/16 fractional-sample accuracy mvL0[0][0] and mvL1[0][0], 
             the reference indices refIdxL0 and refIdxL1, 
             the prediction list utilization flags predFlagL0[0][0] and predFlagL1[0][0], 
             the bi-prediction weight index gbiIdx.
 
The bi-prediction weight index gbiIdx is set equal to 0.
 
The variables xSmr, ySmr, smrWidth, smrHeight, and smrNumHmvpCand are derived as follows:
 
xSmr=IsInSmr[ xCb ][ yCb ]?SmrX[ xCb ][ yCb ]: xCb   (8-276)
 
ySmr=IsInSmr[ xCb ][ yCb ]?SmrY[ xCb ][ yCb ]: yCb   (8-277)
 
smrWidth=IsInSmr[ xCb ][ yCb ]?SmrW[ xCb ][ yCb ]:cbWidth  (8-278)
 
smrHeight=IsInSmr[ xCb ][ yCb ]?SmrH[ xCb ][ yCb ]:cbHeight  (8-279)
 
smrNumHmvpCand=IsInSmr[ xCb ][ yCb ]?NumHmvpSmrCand:NumHmvpCand   (8-280)
 
The motion vectors mvL0[0][0] and mvL1[0][0], the reference indices refIdxL0 and refIdxL1 and the prediction utilization flags predFlagL0[0][0] and predFlagL1[0][0] are derived by the following ordered steps:
 
             1. The derivation process for merging candidates from neighbouring coding units as specified in clause 8.5.2.3 is invoked with the luma coding block location (xCb, yCb) set equal to (xSmr, ySmr), the luma coding block width cbWidth, and the luma coding block height cbHeight set equal to smrWidth and smrHeight as inputs, and the output being the availability flags availableFlagA 0 , availableFlagA 1 , availableFlagB 0 , availableFlagB 1  and availableFlagB 2 , the reference indices refIdxLXA 0 , refIdxLXA 1 , refIdxLXB 0 , refIdxLXB 1  and refIdxLXB 2 , the prediction list utilization flags predFlagLXA 0 , predFlagLXA 1 , predFlagLXB 0 , predFlagLXB 1  and predFlagLXB 2 , and the motion vectors mvLXA 0 , mvLXA 1 , mvLXB 0 , mvLXB 1  and mvLXB 2 , with X being 0 or 1, and the bi-prediction weight indices gbiIdxA 0 , gbiIdxA 1 , gbiIdxB 0 , gbiIdxB 1 , gbiIdxB 2 . 
             2. The reference indices, refIdxLXCol, with X being 0 or 1, and the bi-prediction weight index gbiIdxCol for the temporal merging candidate Col are set equal to 0. 
             3. The derivation process for temporal luma motion vector prediction as specified in in clause 8.5.2.11 is invoked with the luma location (xCb, yCb) set equal to (xSmr, ySmr), the luma coding block width cbWidth, the luma coding block height cbHeight set equal to smrWidth and smrHeight and the variable refIdxL0Col as inputs, and the output being the availability flag availableFlagL0Col and the temporal motion vector mvL0Col. The variables availableFlagCol, predFlagL0Col and predFlagL1Col are derived as follows:
 
availableFlagCol=availableFlagL0Col   (8-281)
 
predFlagL0Col=availableFlagL0Col  (8-282)
 
predFlagL1Col=0  (8-283)
 
             4. When tile_group_type is equal to B, the derivation process for temporal luma motion vector prediction as specified in clause 8.5.2.11 is invoked with the luma location (xCb, yCb) set equal to (xSmr, ySmr), the luma coding block width cbWidth, the luma coding block height cbHeight set equal to smrWidth and smrHeight and the variable refIdxL1Col as inputs, and the output being the availability flag availableFlagL1Col and the temporal motion vector mvL1Col. The variables availableFlagCol and predFlagL1Col are derived as follows:
 
availableFlagCol=availableFlagL0Col∥availableFlagL1Col  (8-284)
 
predFlagL1Col=availableFlagL1Col  (8-285)
 
             5. The merging candidate list, mergeCandList, is constructed as follows: 
           
         
       
    
     
       
         
           
               
               
               
             
               
                   
                   
               
             
            
               
                   
                 i = 0 
                   
               
               
                   
                 if( availableFlagA 1  ) 
                   
               
               
                   
                  mergeCandList[ i++ ] = A 1   
                   
               
               
                   
                 if( availableFlagB 1  ) 
                   
               
               
                   
                  mergeCandList[ i++ ] = B 1   
                   
               
               
                   
                 if( availableFlagB 0  ) 
                   
               
               
                   
                  mergeCandList[ i++ ] = B 0   
                 (8-286) 
               
               
                   
                 if( availableFlagA 0  ) 
                   
               
               
                   
                  mergeCandList[ i++ ] = A 0   
                   
               
               
                   
                 if( availableFlagB2 ) 
                   
               
               
                   
                  mergeCandList[ i++ ] = B 2   
                   
               
               
                   
                 if( availableFlagCol ) 
                   
               
               
                   
                  mergeCandList[ i++ ] = Col 
               
               
                   
                   
               
            
           
         
       
         
         
           
             6. The variable numCurrMergeCand and numOrigMergeCand are set equal to the number of merging candidates in the mergeCandList. 
             7. When numCurrMergeCand is less than 5 [[(MaxNumMergeCand−1)]] and smrNumHmvpCand is greater than 0, the following applies:
           The derivation process of history-based merging candidates as specified in 8.5.2.6 is invoked with mergeCandList, isInSmr set equal to IsInSmr[xCb][yCb], and numCurrMergeCand as inputs, and modified mergeCandList and numCurrMergeCand as outputs.   numOrigMergeCand is set equal to numCurrMergeCand.   
         
             8. When numCurrMergeCand is less than MaxNumMergeCand and greater than 1, the following applies:
           The derivation process for pairwise average merging candidate specified in clause 8.5.2.4 is invoked with mergeCandList, the reference indices refIdxL0N and refIdxL1N, the prediction list utilization flags predFlagL0N and predFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList, numCurrMergeCand and numOrigMergeCand as inputs, and the output is assigned to mergeCandList, numCurrMergeCand, the reference indices refIdxL0avgCand and refIdxL1avgCand, the prediction list utilization flags predFlagL0avgCand and predFlagL1avgCand and the motion vectors mvL0avgCand and mvL1 avgCand of candidate avgCand being added into mergeCandList. The bi-prediction weight index gbiIdx of candidate avgCand being added into mergeCandList is set equal to 0.   numOrigMergeCand is set equal to numCurrMergeCand.   
         
             9. The derivation process for zero motion vector merging candidates specified in clause 8.5.2.5 is invoked with the mergeCandList, the reference indices refIdxL0N and refIdxL1N, the prediction list utilization flags predFlagL0N and predFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList and numCurrMergeCand as inputs, and the output is assigned to mergeCandList, numCurrMergeCand, the reference indices refIdxL0zeroCand m  and refIdxL1zeroCand m , the prediction list utilization flags predFlagL0zeroCand m  and predFlagL1zeroCand m  and the motion vectors mvL0zeroCand m  and mvL1zeroCand m  of every new candidate zeroCand m  being added into mergeCandList. The bi-prediction weight index gbiIdx of every new candidate zeroCand m  being added into mergeCandList is set equal to 0. The number of candidates being added, numZeroMergeCand, is set equal to (numCurrMergeCand−numOrigMergeCand). When numZeroMergeCand is greater than 0, m ranges from 0 to numZeroMergeCand−1, inclusive. 
             10. The following assignments are made with N being the candidate at position merge_idx[xCb][yCb] in the merging candidate list mergeCandList (N=mergeCandList[merge_idx[xCb][yCb]]) and X being replaced by 0 or 1:
 
refIdxLX=refIdxLXN  (8-287)
 
predFlagLX[0][0]=predFlagLXN  (8-288)
 
mvLX[0][0][0]=mvLXN[0]  (8-289)
 
mvLX[0][0][1]=mvLXN[1]  (8-290)
 
gbiIdx=gbiIdxN  (8-291)
 
             11. When mmvd_flag[xCb][yCb] is equal to 1, the following applies:
           The derivation process for merge motion vector difference as specified in 8.5.2.7 is invoked with the luma location (xCb, yCb), the luma motion vectors mvL0[0][0], mvL1[0][0], the reference indices refIdxL0, refIdxL1 and the prediction list utilization flags predFlagL0[0][0] and predFlagL1[0][0] as inputs, and the motion vector differences mMvdL0 and mMvdL1 as outputs.   The motion vector difference mMvdLX is added to the merge motion vectors mvLX for X being 0 and 1 as follows:
 
mvLX[0][0][0]+=mMvdLX[0]   (8-292)
 
mvLX[0][0][1]+=mMvdLX[1]   (8-293)
 
8.5.2.5 Derivation Process for Zero Motion Vector Merging Candidates
 
Inputs to this process are:
   
         
             a merging candidate list mergeCandList, 
             the reference indices refIdxL0N and refIdxL1N of every candidate N in mergeCandList, 
             the prediction list utilization flags predFlagL0N and predFlagL1N of every candidate N in mergeCandList, 
             the motion vectors mvL0N and mvL1N of every candidate N in mergeCandList, 
             the number of elements numCurrMergeCand within mergeCandList.
 
Outputs of this process are:
 
             the merging candidate list mergeCandList, 
             the number of elements numCurrMergeCand within mergeCandList, 
             the reference indices refIdxL0zeroCand m  and refIdxL1zeroCand m  of every new candidate zeroCand m  added into mergeCandList during the invocation of this process, 
             the prediction list utilization flags predFlagL0zeroCand m  and predFlagL1zeroCand m  of every new candidate zeroCand m  added into mergeCandList during the invocation of this process, 
             the motion vectors mvL0zeroCand m  and mvL1zeroCand m  of every new candidate zeroCand n , added into mergeCandList during the invocation of this process.
 
The variable numRefIdx is derived as follows:
 
             If tile_group_type is equal to P, numRefIdx is set equal to NumRefIdxActive[0]. 
             Otherwise (tile_group_type is equal to B), numRefIdx is set equal to Min(NumRefIdxActive[0], NumRefIdxActive[1]).
 
When numCurrMergeCand is less than MaxNumMergeCand, the variable numInputMergeCand is set equal to numCurrMergeCand, the variable zeroIdx is set equal to 0 and the following ordered steps are repeated until numCurrMergeCand is equal to 6 [[MaxNumMergeCand]]):
 
             1. For the derivation of the reference indices, the prediction list utilization flags and the motion vectors of the zero motion vector merging candidate, the following applies:
           If tile_group_type is equal to P, the candidate zeroCand m  with m equal to (numCurrMergeCand−numInputMergeCand) is added at the end of mergeCandList, i.e., mergeCandList[numCurrMergeCand] is set equal to zeroCand m , and the reference indices, the prediction list utilization flags and the motion vectors of zeroCand m  are derived as follows and numCurrMergeCand is incremented by 1:
 
refIdxL0zeroCand m =(zeroIdx&lt;numRefIdx)?zeroIdx:0  (8-335)
 
refIdxL1zeroCand m =−1  (8-336)
 
predFlagL0zeroCand m =1  (8-337)
 
predFlagL1zeroCand m =0  (8-338)
 
mvL0zeroCand m [0]=0  (8-339)
 
mvL0zeroCand m [1]=0  (8-340)
 
mvL1zeroCand m [0]=0  (8-341)
 
mvL1zeroCand m [1]=0  (8-342)
 
numCurrMergeCand=numCurrMergeCand+1  (8-343)
   Otherwise (tile_group_type is equal to B), the candidate zeroCand m  with m equal to (numCurrMergeCand−numInputMergeCand) is added at the end of mergeCandList, i.e., mergeCandList[numCurrMergeCand] is set equal to zeroCand m , and the reference indices, the prediction list utilization flags and the motion vectors of zeroCand m  are derived as follows and numCurrMergeCand is incremented by 1:
 
refIdxL0zeroCand m =(zeroIdx&lt;numRefIdx)?zeroIdx:0  (8-344)
 
refIdxL1zeroCand m =(zeroIdx&lt;numRefIdx)?zeroIdx:0  (8-345)
 
predFlagLOzeroCand m =1  (8-346)
 
predFlagL1zeroCand m =1  (8-347)
 
mvL0zeroCand m [0]=0  (8-348)
 
mvL0zeroCand m [1]=0  (8-349)
 
mvL1zeroCand m [0]=0  (8-350)
 
mvL1zeroCand m [1]=0  (8-351)
 
numCurrMergeCand=numCurrMergeCand+1  (8-352)
   
         
             2. The variable zeroIdx is incremented by 1. 
           
         
       
    
       FIG.  25    is a block diagram of a video processing apparatus  2500 . The apparatus  2500  may be used to implement one or more of the methods described herein. The apparatus  2500  may be embodied in a smartphone, tablet, computer, Internet of Things (IoT) receiver, and so on. The apparatus  2500  may include one or more processors  2502 , one or more memories  2504  and video processing hardware  2506 . The processor(s)  2502  may be configured to implement one or more methods described in the present document. The memory (memories)  2504  may be used for storing data and code used for implementing the methods and techniques described herein. The video processing hardware  2506  may be used to implement, in hardware circuitry, some techniques described in the present document. 
       FIG.  26    is a block diagram showing an example video processing system  2600  in which various techniques disclosed herein may be implemented. Various implementations may include some or all of the components of the system  2600 . The system  2600  may include input  2602  for receiving video content. The video content may be received in a raw or uncompressed format, e.g., 8 or 10 bit multi-component pixel values, or may be in a compressed or encoded format. The input  2602  may represent a network interface, a peripheral bus interface, or a storage interface. Examples of network interface include wired interfaces such as Ethernet, passive optical network (PON), etc. and wireless interfaces such as Wi-Fi or cellular interfaces. 
     The system  2600  may include a coding component  2604  that may implement the various coding or encoding methods described in the present document. The coding component  2604  may reduce the average bitrate of video from the input  2602  to the output of the coding component  2604  to produce a coded representation of the video. The coding techniques are therefore sometimes called video compression or video transcoding techniques. The output of the coding component  2604  may be either stored, or transmitted via a communication connected, as represented by the component  2606 . The stored or communicated bitstream (or coded) representation of the video received at the input  2602  may be used by the component  2608  for generating pixel values or displayable video that is sent to a display interface  2610 . The process of generating user-viewable video from the bitstream representation is sometimes called video decompression. Furthermore, while certain video processing operations are referred to as “coding” operations or tools, it will be appreciated that the coding tools or operations are used at an encoder and corresponding decoding tools or operations that reverse the results of the coding will be performed by a decoder. 
     Examples of a peripheral bus interface or a display interface may include universal serial bus (USB) or high definition multimedia interface (HDMI) or Displayport, and so on. Examples of storage interfaces include SATA (serial advanced technology attachment), PCI, IDE interface, and the like. The techniques described in the present document may be embodied in various electronic devices such as mobile phones, laptops, smartphones or other devices that are capable of performing digital data processing and/or video display. 
       FIG.  27    is a flowchart for an example of a video processing method. The method  2700  includes, at operation  2710 , determining, based on a first threshold (T1), a maximum number of history-based motion vector prediction (HMVP) candidates to be checked in a table. 
     The method  2700  further includes, at operation  2720 , making a decision regarding a selective checking of a number of the HMVP candidates in an order, the number of the HMVP candidates checked not exceeding the maximum number of HMVP candidates. 
     The method  2700  further includes, at operation  2730 , constructing, based on the decision, a motion candidates list. 
     The method  2700  further includes, at operation  2740 , performing, based on the motion candidates list, a conversion between a current block and a bitstream representation of the current block. 
       FIG.  28    is a flowchart for another example of video processing method. The method  2800  includes, at operation  2810 , constructing a merge list comprising a plurality of allowed merge candidates. In some embodiments, a number of the plurality of allowed merge candidates for a current block is smaller than or equal to a maximum list size. 
     The method  2800  further includes, at operation  2820 , performing, based on the merge list, a conversion between the current block and a bitstream representation of the current block. 
       FIG.  29    is a flowchart for yet another example of video processing method. The method  2900  includes, at operation  2910 , constructing, based on a selective invocation of merge list construction process and a virtual candidate derivation process, a triangular merge list. 
     The method  2900  further includes, at operation  2920 , performing, based on the triangular merge list, a conversion between a current block and a bitstream representation of the current block. 
     In some embodiments, the merge list construction process comprises constructing at least one of a spatial candidate, a temporal candidate, a history-based motion vector prediction (HMVP) candidate or a pairwise averaged candidate, and the virtual candidate derivation process comprises directly copying motion information of one or more merge candidates. 
     In some embodiments, the following technical solutions be may implemented: 
     1. A method for video processing, comprising: determining, based on a first threshold (T1), a maximum number of history-based motion vector prediction (HMVP) candidates to be checked in a table; making a decision regarding a selective checking of a number of the HMVP candidates in an order, the number of the HMVP candidates checked not exceeding the maximum number of HMVP candidates; constructing, based on the decision, a motion candidates list; and performing, based on the motion candidates list, a conversion between a current block and a bitstream representation of the current block. 
     2. The method of solution 1, wherein the maximum number of HMVP candidates to be checked is equal to the first threshold. 
     3. The method of solution 1 or 2, wherein the first threshold is a variable threshold. 
     4. The method of solution 1 or 2, wherein the first threshold is pre-determined. 
     5. The method of any of solutions 2 to 4, wherein T1=5. 
     6. The method of solution 1, wherein one or more of the HMVP candidates in the table is checked in the order upon a determination that a number of available motion candidates in the motion candidates list, before checking the HMVP candidates, is smaller than the first threshold. 
     7. The method of solution 1, wherein none of the HMVP candidates in the table is checked upon a determination that a number of available motion candidates in the motion candidates list, before checking the HMVP candidates, is greater than or equal to the first threshold. 
     8. The method of solution 6 or 7, wherein the number of available motion candidates is determined after at least a pruning operation is applied to motion candidates derived from spatial or temporal neighboring blocks. 
     9. The method of solution 1, wherein checking the HMVP candidates in the table is terminated upon a determination that a number of available motion candidates in the motion candidates list, including added HMVP candidates, has reached a maximally allowed number of motion candidates. 
     10. The method of solution 1, wherein checking the HMVP candidates in the table is terminated upon a determination that a number of available motion candidates in the motion candidates list, including added HMVP candidates, has reached a maximally allowed number of motion candidates minus a second threshold (T2). 
     11. The method of solution 10, wherein T2 is a predefined positive integer. 
     12. The method of solution 11, wherein T2=1, 2, or 3. 
     13. The method of solution 11, wherein T2 is configured to be adaptively changed between the current block and a subsequent block. 
     14. The method of solution 11, wherein T2 is signaled in a sequence parameter set (SPS), a picture parameter set (PPS) or a slice header. 
     15. The method of solution 11, wherein T2 is based on a shape, size or coding mode of the current block. 
     16. The method of solution 1, wherein checking the HMVP candidates in the table is terminated upon a determination that a number of added motion candidates has reached a maximally allowed number of motion candidates. 
     17. The method of solution 16, wherein the maximally allowed number of motion candidates is signaled in the bitstream representation or predefined. 
     18. The method of solution 16, wherein the maximally allowed number of motion candidates is based on a shape, size or coding mode of the current block. 
     19. The method of any of solutions 1 to 18, wherein the motion candidates list comprises at least one of a merge or advanced motion vector prediction (AMVP) candidate list. 
     20. A method for video processing, comprising: constructing a merge list comprising a plurality of allowed merge candidates, wherein a number of the plurality of allowed merge candidates for a current block is smaller than or equal to a maximum list size; and performing, based on the merge list, a conversion between the current block and a bitstream representation of the current block. 
     21. The method of solution 20, wherein the maximum list size is 6. 
     22. The method of solution 20, wherein an indication of the number of the plurality of allowed merge candidates is signaled in a sequence parameter set (SPS), a slice header, a picture header, a tile group header or a video data unit. 
     23. The method of solution 20, wherein parsing a merge index is based on the number of the plurality of allowed merge candidates, and decoupled from the maximum list size. 
     24. The method of solution 23, wherein a parsed merge index of current block is no greater than the number of the plurality of allowed merge candidates. 
     25. The method of solution 23, wherein the merge list is constructed based on the maximum list size, and decoupled from the number of the plurality of allowed merge candidates. 
     26. The method of solution 20, further comprising: making, based on a threshold and a number of available merge candidates in the merge list before checking history-based motion vector prediction (HMVP) candidates, a decision regarding a selective application of an HMVP candidate derivation process. 
     27. The method of solution 26, wherein the threshold is equal to 5. 
     28. The method of solution 26 or 27, wherein the HMVP candidate derivation process is not applied when the number of the plurality of allowed merge candidates is no less than the threshold. 
     29. The method of solution 20, further comprising: making, based on a threshold and a number of available merge candidates in the merge list before invoking a pairwise averaged candidate derivation process, a decision regarding a selective application of the pairwise averaged candidate derivation process. 
     30. The method of solution 29, wherein the threshold is equal to 6. 
     31. The method of solution 29 or 30, wherein the pairwise averaged candidate derivation process is not applied when the number of the plurality of allowed merge candidates is no less than the threshold. 
     32. The method of solution 20, further comprising: making, based on a threshold and a number of available merge candidates, a decision regarding a selective application of a zero motion candidate derivation process. 
     33. The method of solution 32, wherein the threshold is equal to 6. 
     34. The method of solution 32 or 33, wherein the zero motion candidate derivation process is not applied when the number of the plurality of allowed merge candidates is no less than the threshold. 
     35. The method of any of solutions 20 to 34, wherein the merge list comprises a regular merge list, a sub-block merge list, an intra-block copy (IBC) or a triangular merge list. 
     36. A method for video processing, comprising: constructing, based on a selective invocation of merge list construction process and a virtual candidate derivation process, a triangular merge list; and performing, based on the triangular merge list, a conversion between a current block and a bitstream representation of the current block, wherein the merge list construction process comprises constructing at least one of a spatial candidate, a temporal candidate, a history-based motion vector prediction (HMVP) candidate or a pairwise averaged candidate, and wherein the virtual candidate derivation process comprises directly copying motion information of one or more merge candidates. 
     37. The method of solution 36, wherein the merge list construction process comprises constructing each of the spatial candidate, the temporal candidate, the HMVP candidate and the pairwise averaged candidate. 
     38. The method of solution 36, wherein the virtual candidate derivation process is invoked when a number of merge candidates from the merge list construction process is smaller than a maximum number of allowed triangular partitioning mode (TPM) candidates. 
     39. The method of any of solutions 1 to 38, wherein the conversion generates the current block from the bitstream representation. 
     40. The method of any of solutions 1 to 38, wherein the conversion generates the bitstream representation from the current block. 
     41. An apparatus in a video system comprising a processor and a non-transitory memory with instructions thereon, wherein the instructions upon execution by the processor, cause the processor to implement the method in any one of solutions 1 to 40. 
     42. A computer program product stored on a non-transitory computer readable media, the computer program product including program code for carrying out the method in any one of solutions 1 to 40. 
     Some embodiments of the disclosed technology include making a decision or determination to enable a video processing tool or mode. In an example, when the video processing tool or mode is enabled, the encoder will use or implement the tool or mode in the processing of a block of video, but may not necessarily modify the resulting bitstream based on the usage of the tool or mode. That is, a conversion from the block of video to the bitstream representation of the video will use the video processing tool or mode when it is enabled based on the decision or determination. In another example, when the video processing tool or mode is enabled, the decoder will process the bitstream with the knowledge that the bitstream has been modified based on the video processing tool or mode. That is, a conversion from the bitstream representation of the video to the block of video will be performed using the video processing tool or mode that was enabled based on the decision or determination. 
     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 the block of video to the bitstream representation of the video. In another example, when the video processing tool or mode is disabled, the decoder will process the bitstream with the knowledge that the bitstream has not been modified using the video processing tool or mode that was enabled based on the decision or determination. 
     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 deviating from the scope of the invention. Accordingly, the presently disclosed technology is not limited except as by the appended claims. 
     The disclosed and other embodiments, modules and the functional operations described in this document can be implemented in digital electronic circuitry, or in computer software, firmware, or hardware, including the structures disclosed in this document and their structural equivalents, or in combinations of one or more of them. The disclosed and other embodiments can be implemented as one or more computer program products, i.e., one or more modules of computer program instructions encoded on a computer readable medium for execution by, or to control the operation of, data processing apparatus. The computer readable medium can be a machine-readable storage device, a machine-readable storage substrate, a memory device, a composition of matter effecting a machine-readable propagated signal, or a combination of one or more them. The term “data processing apparatus” encompasses all apparatus, devices, and machines for processing data, including by way of example a programmable processor, a computer, or multiple processors or computers. The apparatus can include, in addition to hardware, code that creates an execution environment for the computer program in question, e.g., code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them. A propagated signal is an artificially generated signal, e.g., a machine-generated electrical, optical, or electromagnetic signal, that is generated to encode information for transmission to suitable receiver apparatus. 
     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 can 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 that store one or more modules, sub programs, or portions of code). A computer program can be deployed to be executed on one computer or on multiple computers that are located at one site or distributed across multiple sites and interconnected by a communication network. 
     The processes and logic flows described in this document 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, and apparatus can also be implemented as, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application specific integrated circuit). 
     Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read only memory or a random-access memory or both. The essential elements of a computer are a processor for performing instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto optical disks, or optical disks. However, a computer need not have such devices. Computer readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media and memory devices, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto optical disks; and CD ROM and DVD-ROM disks. The processor and the memory can be supplemented by, or incorporated in, special purpose logic circuitry. 
     While this patent document contains many specifics, these should not be construed as limitations on the scope of any invention or of what may be claimed, but rather as descriptions of features that may be specific to particular embodiments of particular inventions. Certain features that are described in this patent document in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Moreover, although features may be described above as acting in certain combinations and even initially claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a subcombination or variation of a subcombination. 
     Similarly, while operations are depicted in the drawings in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. Moreover, 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. 
     Only a few implementations and examples are described and other implementations, enhancements and variations can be made based on what is described and illustrated in this patent document.