Methods and apparatus for controlling template-based coding tools in video coding

By determining histogram similarity to control template-based tools in video coding, the method reduces computational load and enhances efficiency by selectively applying these tools, addressing the increased requirements of template matching.

WO2025209049A1PCT designated stage Publication Date: 2025-10-09MEDIATEK INC
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/078197
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-03
Filing Date
2025-02-20
Publication Date
2025-10-09

AI Technical Summary

Technical Problem

Template matching tools in video coding significantly increase computational requirements, and there is a need to control their usage effectively to improve coding efficiency.

Method used

A method and apparatus that determine similarity between two histograms from specific regions associated with a current block to decide whether to enable or disable template-based tools, and adjust their parameters based on histogram similarity.

Benefits of technology

Reduces computational load and enhances coding efficiency by selectively applying template-based tools, improving performance without unnecessary processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025078197_09102025_PF_FP_ABST
    Figure CN2025078197_09102025_PF_FP_ABST
Patent Text Reader

Abstract

A method and apparatus for video coding are disclosed. According to this method, input data associated with a current block is received, wherein the input data comprises pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side. Two histograms are determined, wherein the two histograms are collected from two specific regions associated the current block. The template-based tool is applied to the current block depending on the two histograms.
Need to check novelty before this filing date? Find Prior Art

Description

METHODS AND APPARATUS FOR CONTROLLING TEMPLATE-BASED CODING TOOLS IN VIDEO CODINGCROSS REFERENCE TO RELATED APPLICATIONS

[0001] The present invention is a non-Provisional Application of and claims priority to U.S. Provisional Patent Application No. 63 / 573,568, filed on April 3, 2024. The U.S. Provisional Patent Application is hereby incorporated by reference in its entirety.FIELD OF THE INVENTION

[0002] The present invention relates to video coding system. In particular, the present invention relates to control the usage of template matching tools in a video coding system. BACKGROUND AND RELATED ART

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

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

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

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

[0007] I. RELATED ART

[0008] I. 1 Decoder-side Intra Mode Derivation (DIMD)

[0009] When DIMD is applied, two intra modes are derived from the reconstructed neighbouring samples, and those two predictors are combined with the planar mode predictor with the weights derived from the gradients as described in JVET-O0449. The division operations in weight derivation are performed utilizing the same lookup table (LUT) based integerization scheme used by the CCLM. For example, the division operation in the orientation calculation. Orient=Gy / Gx, is computed by the following LUT-based scheme: x = Floor (Log2 (Gx) ) , normDiff = ( (Gx<< 4) >> x) &15, x += (3 + (normDiff! = 0) ? 1: 0) , and Orient = (Gy* (DivSigTable [normDiff] | 8) + (1<< (x-1) ) ) >> x, where DivSigTable

[0016] = {0, 7, 6, 5 , 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0} .

[0010] Derived intra modes are included into the primary list of intra most probable modes (MPM) . Therefore, the DIMD process is performed before the MPM list is constructed. The primary derived intra mode of a DIMD block is stored with the block and is used for MPM list construction of the neighbouring blocks.

[0011] I. 2 DIMD Chroma Mode

[0012] The DIMD chroma mode uses the DIMD derivation method to derive the chroma intra prediction mode of the current block based on the neighbouring reconstructed Y, Cb and Cr samples in the second neighbouring row and column as shown in Figs. 2A-C for Y, Cb and Cr components (Fig. 2A, Fig. 2B and Fig. 2C) respectively. Specifically, a horizontal gradient and a vertical gradient are calculated for each collocated reconstructed luma sample of the current chroma block, as well as the reconstructed Cb and Cr samples, to build a HoG. Then the intra prediction mode with the largest histogram amplitude values is used for performing chroma intra prediction of the current chroma block.

[0013] When the intra prediction mode derived from the DIMD chroma mode is the same as the intra prediction mode derived from the DM mode, the intra prediction mode with the second largest histogram amplitude value is used as the DIMD chroma mode. A CU level flag is signalled to indicate whether the proposed DIMD chroma mode is applied.

[0014] I. 3 Fusion for Template-based Intra Mode Derivation (TIMD)

[0015] For each intra prediction mode in MPMs, the SATD (Sum of Absolute Transformed Differences) between the prediction and reconstruction samples of the template is calculated. Normally, the left and above neighbouring reconstructed samples are used as the template. First two intra prediction modes with the minimum SATD are selected as the TIMD modes. These two TIMD modes are fused with the weights after applying PDPC (Position Dependent Prediction Combination) process, and such weighted intra prediction is used to code the current CU. PDPC is included in the derivation of the TIMD modes.

[0016] The costs of the two selected modes are compared with a threshold. In the test, the cost factor of 2 is applied as follows: costMode2 < 2*costMode1.

[0017] If this condition is true, the fusion is applied, otherwise the only mode1 is used.

[0018] Weights of the modes are computed from their SATD costs as follows: weight1 = costMode2  /  (costMode1+ costMode2) weight2 = 1 -weight1.

[0019] The division operations are conducted using the same lookup table (LUT) based integerization scheme used by the CCLM.

[0020] I. 4 Intra Prediction Fusion

[0021] This intra prediction method derives predicted samples as a weighted combination of multiple predictors generated from different reference lines. In this process multiple intra predictors are generated and then fused by weighted averaging. The process of deriving the predictors to be used in the fusion process is described as follows: 1) For angular intra prediction modes including the single mode case of TIMD and DIMD,  the proposed method derives intra prediction by weighted intra predictions obtained from multiple reference lines represented as pfusion=w0pline+w1pline+1, where pline is the intra prediction from the default reference line and pline+1 is the prediction from the line above the default reference line. The weights are set as w0=3 / 4 and w1=1 / 4. 2) For TIMD mode with blending, plime is used for the first mode (w0=1, w1=0) and  pline+1 is used for the second mode (w0=0, w1=1) . 3) For DIMD mode with blending, the number of predictors selected for a weighted average  is increased from 3 to 6.

[0022] Intra prediction fusion method is applied to luma blocks when angular intra mode has non-integer slope (required reference samples interpolation) and the block size is greater than 16, it is used with MRL and not applied for ISP coded blocks. In the method studied in the sub-test, PDPC is applied for the intra prediction mode using the closest to the current block reference line.

[0023] I. 5 Fusion of Chroma Intra Prediction Modes

[0024] In ECM, two chroma intra prediction signals can be fused together. One of the two chroma intra prediction signals is predicted using one of the DM mode, DIMD chroma mode and the four default modes (non-LM mode) . The other chroma intra prediction signal is predicted using cross-component linear prediction modes (LM mode) . Two different methods are supported.

[0025] In the first method, the LM mode can be either MM-CCLM or MM-CCCM, and the final predictor is derived as follows: predC (i, j) = (w0×pred0 (i, j) +w1×pred1 (i, j) + (1<< (shift-1) ) ) >>shift where pred0 (i, j) is the predictor obtained by applying the non-LM mode, pred1 (i, j) is the  predictor obtained by applying the LM mode and predC (i, j) is the final predictor of the current chroma block. The two weights, w0 and w1 are determined by the intra prediction mode of adjacent chroma blocks and shift is set equal to 2. Specifically, when the above and left adjacent blocks are both coded with LM modes, set {w0, w1} = {1, 3} ; when the above and left adjacent blocks are both coded with non-LM modes, set {w0, w1} = {3, 1} ; otherwise, set {w0, w1} = {2, 2} . Two template costs are calculated by fusing the angular chroma prediction with MM-CCLM or MM-CCCM, respectively, and the one of two CCPs which provides a smaller template cost is utilized to derive pred1.

[0026] In the second method, the LM mode can be either MMLM or CCLM mode, and the final predictor is derived as follows: predC (i, j) = α0×pred0 (i, j) + α1×rec′L (i, j) +α2×β where pred0 (i, j) is the predictor obtained by applying the non-LM mode, rec′L (i, j) is the set of  downsampled reconstructed luma samples at co-located positions and predC (i, j) is the final predictor of the current chroma block. β is a fixed value and is set equal to 512 for 10-bit content. The three weights, α0, α1 and α2 are derived from the adjacent luma and chroma samples using the same LDL derivation method as in CCCM.

[0027] I. 6 Intra Template Matching

[0028] Intra template matching prediction (IntraTMP) is a special intra prediction mode that copies the best prediction block from the reconstructed part of the current frame, whose L-shaped template matches the current template. For a predefined search range, the encoder searches for the most similar template to the current template in a reconstructed part of the current frame and uses the corresponding block as a prediction block. The encoder then signals the usage of this mode, and the same prediction operation is performed at the decoder side.

[0029] The prediction signal is generated by matching the L-shaped, Top-Only or Left-Only causal neighbour of the current block with another block in a predefined search area. There are 6 predefined search areas, which contain the reconstructed samples from the top and left CTUs as well as part of the reconstructed samples within the current CTU that are located above, left, bottom-left and top-right to the current block. Sum of absolute differences (SAD) is used as a cost function.

[0030] I. 7 Template-based Multiple Reference Line Intra Prediction

[0031] Template-based Multiple Reference Line (TMRL) intra prediction mode combines reference line and prediction mode together and uses a template matching method to construct a list of candidate combinations. An index to the candidate combination list is coded to indicate which reference line and prediction mode are used in coding the current block. The regular multiple reference line (MRL) for the non-TIMD part is replaced by TMRL mode.

[0032] The TMRL mode extends reference line candidate list and the intra-prediction-mode candidate list. The extended reference line candidate list is {1, 3, 5, 7, 12} . The restriction on the top CTU row is unchanged. The size of the intra-prediction-mode candidate list is 10. The construction of the intra-prediction-mode candidate list is similar to MPM except that the PLANAR mode is excluded from the intra-prediction-mode candidate list. Also, DC mode is added to the intra-prediction-mode candidate list after 5 neighbouring PUs’ modes and DIMD modes if the DC mode is not included. Furthermore, the angular modes with delta angles from ±1 to ±4 (compared the existing angular modes in the intra-prediction-mode candidate list) are added to the intra-prediction-mode candidate list. The precision of angular prediction is extended from 65 to 129. Additionally, non-adjacent positions are added as candidates in constructing the intra candidate list. If the neighbouring or non-adjacent blocks are coded with SGPM or GPM modes, the intra modes of the blocks are replaced by the partitioning angles.

[0033] The TMRL candidate is constructed as follows. There are 5x10=50 combinations of the extended reference line and the allowed intra-prediction modes for a block. Since the extended reference line starts from reference line 1, the area covered by reference line 0 is used for template matching. The SAD costs over the template area (see Fig. 3) are calculated between the predictions (generated by 50 combinations) and the reconstructions. The 20 combinations with the least SAD cost are selected in an ascending order to form the TMRL candidate list.

[0034] For TMR signalling, instead of coding the reference line and the intra mode directly, an index for the TMRL candidate list is coded to indicate which combination of reference line and prediction mode is used for coding the current block.

[0035] I. 8 Convolutional Cross-Component Intra Prediction Model (CCCM)

[0036] In this method, convolutional cross-component model (CCCM) is applied to predict chroma samples from reconstructed luma samples in a similar spirit as done by the current CCLM modes. As with CCLM, the reconstructed luma samples are down-sampled to match the lower-resolution chroma grid when chroma sub-sampling is used. Similar to CCLM, top, left or top and left reference samples are used as templates for model derivation.

[0037] Also, similar to CCLM, there is an option of using a single model or multi-model variant of CCCM. The multi-model variant uses two models, one model derived for samples above the average luma reference value and another model for the rest of the samples (following the spirit of the CCLM design) . Multi-model CCCM mode can be selected for PUs which have at least 128 reference samples available.

[0038] I. 8.1 Convolutional filter of CCCM

[0039] The convolutional 7-tap filter consist of a 5-tap plus-sign-shaped spatial component, a nonlinear term and a bias term. The input to the spatial 5-tap component of the filter consists of a centre (C) luma sample which is collocated with the chroma sample to be predicted and its above / north (N) , below / south (S) , left / west (W) and right / east (E) neighbours as illustrated in Fig. 4.

[0040] The nonlinear term P is represented as power-of-two of the centre luma sample C and scaled to the sample value range of the content: P = (C*C + midVal ) >> bitDepth.

[0041] That is, for 10-bit content it is calculated as: P = (C*C + 512 ) >> 10.

[0042] The bias term B represents a scalar offset between the input and output (similar to the offset term in CCLM) and is set to middle chroma value (i.e., 512 for 10-bit content) .

[0043] Output of the filter is calculated as a convolution between the filter coefficients ci and the input values, and then clipped to the range of valid chroma samples: predChromaVal = c0C + c1N + c2S + c3E + c4W + c5P + c6B.

[0044] I. 8.2 Calculation of filter coefficients of CCCM

[0045] The filter coefficients ci are calculated by minimising MSE between predicted and reconstructed chroma samples in the reference area. Fig. 3 illustrates the reference area which consists of 2 or 6 lines of chroma samples above and left of the PU. Whether to use 6 lines or 2 lines of neighbouring samples to derive the CCCM model parameters in the single model CCCM is determined by a template cost. Similarly, for the multi-model CCCM mode, the two candidates use 6 lines neighbouring luma samples or luma samples collocated with the current chroma block to derive mean values, which are used to separate samples into two groups. The cost is derived by applying the candidate CCP (either 2 or 6 lines) on a template, calculating the sum of absolute difference (SAD) between CCP predicted samples and reconstructed samples in the template.

[0046] The MSE minimization is performed by calculating autocorrelation matrix for the luma input and a cross-correlation vector between the luma input and chroma output. Autocorrelation matrix is LDL decomposed and the final filter coefficients are calculated using back-substitution. The process follows roughly the calculation of the ALF filter coefficients in ECM, however LDL decomposition was chosen instead of Cholesky decomposition to avoid using square root operations.

[0047] The autocorrelation matrix is calculated using the reconstructed values of luma and chroma samples. These samples are full range (e.g. between 0 and 1023 for 10-bit content) resulting in relatively large values in the autocorrelation matrix. This requires high bit depth operations during the model parameter calculation. It is proposed to remove fixed offsets from luma and chroma samples in each PU for each model. This is driving down the magnitudes of the values used in the model creation and allows reducing the precision needed for the fixed-point arithmetic. As a result, 16-bit decimal precision is proposed to be used instead of the 22-bit precision of the original CCCM implementation.

[0048] Reference sample values just outside of the top-left corner of the PU are used as the offsets (offsetLuma, offsetCb and offsetCr) for simplicity. The sample values used in both model creation and final prediction (i.e., luma and chroma in the reference area, and luma in the current PU) are reduced by these fixed values, as follows: C'= C –offsetLuma, N'= N –offsetLuma, S'= S –offsetLuma, E'= E –offsetLuma, W'= W –offsetLuma, P'= nonLinear (C') , B = midValue = 1 << (bitDepth -1) , and the chroma value is predicted using the following equation, where offsetChroma is equal to  offsetCr and offsetCb for Cr and Cb components, respectively: predChromaVal = c0C'+ c1N'+ c2S'+ c3E'+ c4W'+ c5P'+ c6B + offsetChroma

[0049] I. 8.3 CCCM signalling

[0050] Usage of the mode is signalled with a CABAC coded PU level flag. One new CABAC context is included to support this. When it comes to signalling, CCCM is considered a sub-mode of CCLM. That is, the CCCM flag is only signalled if intra prediction mode is LM_CHROMA.

[0051] I. 9 Gradient and Location Based Convolutional Cross-Component Model (GL-CCCM)

[0052] This method maps luma values into chroma values using a filter with inputs consisting of one spatial luma sample, two gradient values, two location information, a nonlinear term, and a bias term. The GL-CCCM method uses gradient and location information instead of the 4 spatial neighbour samples used in the CCCM filter. The GL-CCCM filter used for the prediction is: predChromaVal = c0C + c1Gy + c2Gx + c3Y + c4X + c5P + c6B, where Gy and Gx are the vertical and horizontal gradients, respectively, and are calculated as Fig. 5: Gy = (2N + NW + NE) – (2S + SW + SE) . Gx = (2W + NW + SW) – (2E + NE + SE) .

[0053] Moreover, the Y and X are the spatial coordinates of the centre luma sample.

[0054] The rest of the parameters are the same as the CCCM tool. The reference area for the parameter calculation is the same as the CCCM method.

[0055] The usage of the mode is signalled with a CABAC coded PU level flag. When it comes to signalling, GL-CCCM is considered a sub-mode of CCCM. That is, the GL-CCCM flag is only signalled if original CCCM flag is true.

[0056] Similar to the CCCM, GL-CCCM tool has 6 modes for calculating the parameters: ● Single-model GL-CCCM from above and left templates ● Single-model GL-CCCM from above template ● Single-model GL-CCCM from left template ● Multi-model GL-CCCM from above and left templates ● Multi-model GL-CCCM from above template ● Multi-model GL-CCCM from left template

[0057] The encoder performs SATD search for the 6 GL-CCCM modes along with the existing CCCM modes to find the best candidates for full RD tests.

[0058] I. 10 Local Illumination Compensation (LIC)

[0059] LIC is an inter prediction technique to model local illumination variation between a current block and its prediction block as a function of sample value between current block template and reference block template. The parameters of the function can be denoted by a scale α and an offset β, which form a linear equation (i.e., α*p [x] +β) to compensate illumination changes, where p [x] is a reference sample pointed to by MV at a location x in the reference picture. When wrap-around motion compensation is enabled, the MV shall be clipped with wrap-around offset taken into consideration. Since α and β can be derived based on the current block template and reference block template, no signalling overhead is required for them, except that an LIC flag is signalled for AMVP mode to indicate the use of LIC.

[0060] The local illumination compensation proposed in JVET-O0066 is used for uni-prediction inter CUs with the following modifications. ● Intra neighbour samples can be used in LIC parameter derivation; ● LIC is disabled for blocks with less than 32 luma samples; ● For both non-subblock and affine modes, LIC parameter derivation is performed based on  the template block samples corresponding to the current CU, instead of partial template block samples corresponding to first top-left 16x16 unit; ● Samples of the reference block template are generated by using MC with the block MV  without rounding it to integer-pel precision.

[0061] I. 11 Template Matching (TM)

[0062] Template matching (TM) is a decoder-side MV derivation method to refine the motion information of the current CU by finding the closest match between a template (i.e., top 614 and / or left 616 neighbouring blocks of the current CU 612) in the current picture 610 and a block (i.e., same size to the template, block 624 and 626) in a reference picture 620 as shown in Fig. 6. In Fig. 6, a better MV is searched around the initial motion 630 of the current CU 612 of the current picture 610 within a [–8, +8] -pel search range 622 around location 628 in the reference picture 620 as pointed by the initial MV 630. The template matching method in JVET-J0021 is used with the following modifications: search step size is determined based on AMVR mode and TM can be cascaded with bilateral matching process in merge modes.

[0063] In AMVP mode, an MVP candidate is determined based on template matching error to select the one which achieves the minimum difference between the current block template and the reference block template, and then TM is performed only for this particular MVP candidate for MV refinement. TM refines this MVP candidate, starting from full-pel MVD precision (or 4-pel for 4-pel AMVR mode) within a [–8, +8] -pel search range by using iterative 16-point diamond search. The AMVP candidate may be further refined by using cross search with full-pel MVD precision (or 4-pel for 4-pel AMVR mode) , followed sequentially by half-pel and quarter-pel ones depending on AMVR mode. This search process ensures that the MVP candidate still keeps the same MV precision as indicated by the AMVR mode after TM process. In the search process, if the difference between the previous minimum cost and the current minimum cost in the iteration is less than a threshold that is equal to the area of the block, the search process terminates.

[0064] In merge mode, similar search method is applied to the merge candidate indicated by the merge index. TM may perform all the way down to 1 / 8-pel MVD precision or skipping those beyond half-pel MVD precision, depending on whether the alternative interpolation filter (that is used when AMVR is of half-pel mode) is used according to merged motion information. Besides, when TM mode is enabled, template matching may work as an independent process or an extra MV refinement process between block-based and subblock-based bilateral matching (BM) methods, depending on whether BM can be enabled or not according to its enabling condition check.

[0065] I. 12 TM-based Subblock Motion Refinement

[0066] In JVET-AF0168 test3.4a, it is proposed to apply the template matching to subblock based motion tools, including the affine and SbTMVP mode. More specifically, the control point motion vectors (CPMVs) of uni-predicted affine merge candidates and the motion shift of SbTMVP candidates are refined using TM. For a uni-predicted affine merge candidate, a same MV offset is assigned to all the CPMVs, and the TM cost of the affine candidate is calculated accordingly. The optimal CPMV offset with the minimum TM cost can be used to refine the corresponding affine candidate. For a SbTMVP candidate, the initial motion shift can be refined with TM, and then the refined motion shift will be utilized to derive subblock temporal motion information.

[0067] I. 13 Template Matching Based OBMC

[0068] In template matching based OBMC (Overlapped Block Motion Compensation) scheme, instead of directly using the weighted prediction, the prediction value of CU boundary samples derivation approach is decided according to the template matching costs, including using current block’s motion information only, or using neighbouring block’s motion information as well with one of the blending modes.

[0069] In this scheme for each block with a size of 4×4 at the top CU boundary, the above template size equals to 4×1. If N adjacent blocks have the same motion information, then the above template size is enlarged to 4N×1 since the MC operation can be processed at one time. For each left block with a size of 4×4 at the left CU boundary, the left template size equals to 1×4 or 1×4N as shown in Fig. 7, where the thick-lined box 710 corresponds to a CU.

[0070] I. 14 Adaptive Reordering of Merge Candidates with Template Matching (ARMC-TM)

[0071] The merge candidates are adaptively reordered based on template matching (TM) . The reordering method is applied to regular merge mode, TM merge mode, and affine merge mode (excluding the SbTMVP candidate) . For the TM merge mode, merge candidates are reordered before the refinement process.

[0072] An initial merge candidate list is firstly constructed according to given checking order, such as spatial, TMVPs, non-adjacent, HMVPs, pairwise, virtual merge candidates. Then the candidates in the initial list are divided into several subgroups. For the template matching (TM) merge mode, adaptive DMVR mode, each merge candidate in the initial list is firstly refined by using TM / multi-pass DMVR. Merge candidates in each subgroup are reordered to generate a reordered merge candidate list and the reordering is according to cost values based on template matching. The index of selected merge candidate in the reordered merge candidate list is signalled to the decoder. For simplification, merge candidates in the last but not the first subgroup are not reordered. All the zero candidates from the ARMC reordering process are excluded during the construction of merge motion vector candidates list. The subgroup size is set to 5 for regular merge mode and TM merge mode. The subgroup size is set to 3 for affine merge mode.

[0073] I. 15 Geometric Partitioning Mode (GPM) with Template Matching (TM)

[0074] Template matching is applied to GPM. When GPM mode is enabled for a CU, a CU-level flag is signalled to indicate whether TM is applied to both geometric partitions. Motion information for each geometric partition is refined using TM. When TM is chosen, a template is constructed using left, above or left and above neighbouring samples according to partition angle, as shown in Table 1. The motion is then refined by minimizing the difference between the current template and the template in the reference picture using the same search pattern of merge mode with half-pel interpolation filter disabled. Table 1. Template for the 1st and 2nd geometric partitions, where A represents using above  samples, L represents using left samples, and L+A represents using both left and above samples.

[0075] I. 16 Template Matching Based Reordering for GPM Split Modes

[0076] In template matching based reordering for GPM split modes, given the motion information of the current GPM block, the respective TM cost values of GPM split modes are computed. Then, all GPM split modes are reordered in an ascending order based on the TM cost values. Instead of sending GPM split mode, an index using Golomb-Rice code to indicate where the exact GPM split mode located in the reordering list is signalled.

[0077] The reordering method for GPM split modes is a two-step process performed after the respective reference templates of the two GPM partitions in a coding unit are generated, as follows: ● extending GPM partition edge into the reference templates of the two GPM partitions, resulting in 64  reference templates and computing the respective TM cost for each of the 64 reference templates; ● reordering GPM split modes based on their TM cost values in an ascending order and marking the best  32 split modes as available split modes.

[0078] The edge on the template is extended from that of the current CU, as shown in Fig. 8, but GPM blending process is not used in the template area across the edge.

[0079] After ascending reordering using the TM cost, an index is signalled.

[0080] I. 17 IBC with Template Matching

[0081] Template Matching is used in IBC for both IBC merge mode and IBC AMVP mode.

[0082] The IBC-TM merge list is modified compared to the one used by regular IBC merge mode such that the candidates are selected according to a pruning method with a motion distance between the candidates as in the regular TM merge mode. The ending zero motion fulfilment is replaced by motion vectors to the left (-W, 0) , top (0, -H) and top-left (-W, -H) , where W is the width and H the height of the current CU.

[0083] In the IBC-TM merge mode, the selected candidates are refined with the Template Matching method prior to the RDO or decoding process. The IBC-TM merge mode has been put in competition with the regular IBC merge mode and a TM-merge flag is signalled.

[0084] In the IBC-TM AMVP mode, up to 3 candidates are selected from the IBC-TM merge list. Each of those 3 selected candidates is refined using the template matching method and sorted according to their resulting template matching cost. Only the first two are then considered in the motion estimation process.

[0085] The template matching refinement for both IBC-TM merge and AMVP modes is quite simple since IBC motion vectors are constrained (i) to be integer and (ii) within a reference region as shown in Fig. 9. Reference regions 910-940 are for IBC motion vectors of current block when current block is in different position, where illustration 910 corresponds to the case that the current block falls into the top-left 64x64 block of the current CTU, illustration 920 corresponds to the case that the current block falls into the top-right 64x64 block of the current CTU, illustration 930 corresponds to the case that the current block falls into the bottom-left 64x64 block of the current CTU, and illustration 940 corresponds to the case that the current block falls into the bottom-right 64x64 block of the current CTU. Therefore, in IBC-TM merge mode, all refinements are performed at integer precision, and in IBC-TM AMVP mode, they are performed either at integer or 4-pel precision depending on the AMVR value. Such refinement accesses only to samples without interpolation. In both cases, the refined motion vectors and the used template in each refinement step must respect the constraint of the reference region.

[0086] I. 18 MVD Prediction

[0087] In this method, possible MVD sign combinations and possible combinations of the first 6 most signification suffix bins of MVD magnitudes are sorted according to the template matching cost and index corresponding to the true MVD sign and MVD magnitudes is derived and context coded. At the decoder side, the MVD are derived as following: 1. Parse the magnitude of MVD components 2. Parse context coded MVD prediction index 3. Build MV candidates by creating combination between possible signs and possible MVD  magnitudes and add it to the MV predictor 4. Derive MVD prediction cost for each derived MV based on template matching cost and  sort 5. Use the signalled index to pick the true MVD

[0088] MVD prediction is applied to inter AMVP, affine AMVP, MMVD and affine MMVD modes. Note, when wrap-around motion compensation is enabled, the MV candidate shall be clipped with wrap-around offset taken into consideration.

[0089] I. 19 BVD Prediction

[0090] Similar to MVD prediction, possible BVD sign combinations of IBC mode are sorted according to the template matching cost. Moreover, the first 4 most signification suffix bins of exponential Golomb code used to represent BVD magnitudes are also sorted according to the TM cost. An example is shown in Fig. 10, where the BV, BVP and BVD are shown for the current PU 1010. Template matching operation is used to determine a BVD candidate with the best cost, and indicate in the bitstream whether the best candidate is predicted correctly or not.

[0091] I. 20 Block Level Reference Picture List Reordering

[0092] A block level reference picture reordering method based on template matching is used. For the uni-prediction AMVP mode, the reference pictures in List 0 and List 1 are interweaved to generate a joint list. For each hypothesis of the reference picture in the joint list, template matching is performed to calculate the cost. The joint list is reordered based on an ascending order of the template matching cost. The index of the selected reference picture in the reordered joint list is signalled in the bitstream. For the bi-prediction AMVP mode, a list of pairs of reference pictures from List 0 and List 1 is generated and similarly reordered based on the template matching cost. The index of the selected pair of reference pictures is signalled.

[0093] I. 21 Template Matching Based BCW Index Derivation for Merge Mode

[0094] The BCW (Bi-Prediction with CU-level Weight) index for merge coded CUs is derived based on the template matching cost instead of being derived from neighbouring blocks. Given a selected merge candidate, the TM cost values are calculated with different bi-prediction weights, and then, the bi-prediction weight with a minimum TM cost value is used to predict the merge CU.

[0095] When calculating TM cost for bi-predicted weights, the following rules are applied: - Since the inherited bi-predicted weight is likely to have higher accuracy than others, only the  inherited bi-prediction weight and its two neighbouring weights (i.e. ±1) are considered. For example, if the inherited bi-predicted weight is 4, then only three weights {3, 4, 5} are involved in TM cost calculation. - The TM cost of the inherited BCW index is multiplied with 0.90625, that is, the cost is reduced  by 3 / 32. - The TM cost of the equal weight is multiplied with 0.90625 since bi-predicted samples are  beneficial for BDOF and BDOF is only applied to CU with equal weights.

[0096] The template matching based BCW index derivation is applied to CUs coded in regular merge, template matching, adaptive decoder-side motion vector refinement and MMVD modes.

[0097] In addition, the bi-prediction weights for merge mode are extended from {-2, 3, 4, 5, 10} to {1, 2, 3, 4, 5, 6, 7} . Furthermore, the negative bi-predicted weights for non-merge mode {-2, 10} are replaced with positive weights {1, 7} .

[0098] While template matching tools may help to improve coding efficiency, the template matching tools also significantly increase system computational requirements. It is desirable to turn on the template matching tools only when the tools may help to improve the performance. Accordingly, in the present invention, methods and apparatus to control the usage of template matching tools are disclosed. BRIEF SUMMARY OF THE INVENTION

[0099] A method and apparatus for video coding are disclosed. According to this method, input data associated with a current block is received, wherein the input data comprises pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side. Two histograms are determined, wherein the two histograms are collected from two specific regions associated the current block. The template-based tool is applied to the current block depending on the two histograms.

[0100] In one embodiment, if similarity between the two histograms is small, the template-based tool is disabled for the current block. In one embodiment, the similarity between the two histograms is measured by using sum of absolute differences (SAD) between the two histograms as a cost function.

[0101] In one embodiment, the two specific regions correspond to the current block and current template, wherein the current template refers to reconstruction samples adjacent to the current block.

[0102] In one embodiment, the two histograms correspond to distribution of sample values, median or mean value derived from the sample values, variance derived from the sample values, normalized sample values, gradient values or angular directions.

[0103] In one embodiment, if a first difference between first centres of corresponding first bin of the two histograms is smaller than a threshold, a second difference between second centres of corresponding second bin of the two histograms is smaller than the threshold, remaining differences between remaining centres of corresponding remaining first N bins of the two histograms are all smaller than the threshold, or a combination thereof, the template-based tool is enabled.

[0104] In one embodiment, if similarity between the two histograms is small, the template-based tool is applied to the current block with a reduced template candidate set.

[0105] In one embodiment, if similarity between the two histograms is small, search range of template-matching based search or intraTMP associated with the template-based tool is reduced.

[0106] In one embodiment, if similarity between the two histograms is small, a number of candidates of TIMD (Template-based Intra Mode Derivation) , DIMD (Decoder-side Intra Mode Derivation) , OBMC (Overlapped Block Motion Compensation) , TMRL (Template-based Multiple Reference Line) , or intra prediction fusion is reduced.BRIEF DESCRIPTION OF THE DRAWINGS

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

[0108] Fig. 1B illustrates a corresponding decoder for the encoder in Fig. 1A.

[0109] Figs. 2A-C illustrate an example of the DIMD chroma mode using the DIMD derivation method to derive the chroma intra prediction mode of the current block based on the neighbouring reconstructed Y (Fig. 2A) , Cb (Fig. 2B) and Cr (Fig. 2C) samples in the second neighbouring row and column.

[0110] Fig. 3 illustrates an example of template area with multiple reference lines.

[0111] Fig. 4 illustrates spatial part of the convolutional filter for convolutional cross-component intra prediction model.

[0112] Fig. 5 illustrates spatial samples used for gradient and Location based convolutional cross-component model.

[0113] Fig. 6 illustrates an example of template matching used to refine an initial MV by searching an area around the initial MV.

[0114] Fig. 7 illustrates an example of Template Matching based OBMC where, for each top block with a size of 4×4 at the top CU boundary, the above template size equals to 4×1.

[0115] Fig. 8 illustrates an example to extending an edge into the top template for geometric partitioning mode.

[0116] Fig. 9 illustrates an example of current CTU processing order and its available reference samples in current and left CTU.

[0117] Fig. 10 illustrates an example of BVD prediction, where template matching operation is used to determine a BVD candidate with the best cost.

[0118] Fig. 11 illustrates a flowchart of an exemplary video coding system that determines the usage of template matching tools based on two histograms derived from two specific regions according to an embodiment of the present invention.DETAILED DESCRIPTION OF THE INVENTION

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

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

[0121] II. PROPOSED METHOD

[0122] In the current ECM, several template-based methods are proposed. However, when the correlations between current CU and neighbouring template samples are not high enough, the candidate refinement, reordering or regression process based on template cost could be inaccurate for current CU. Therefore, we propose several methods to determine the correlation between the current CU and neighbouring template samples and use the methods to determine the on-off condition of template-based tools. The template-based tool comprises DIMD (Decoder-side Intra Mode Derivation) , TIMD (Template-based Intra Mode Derivation) , Intra Prediction Fusion, IntraTMP, TMRL (Template-based Multiple Reference Line) , CCCM (Convolutional Cross-Component Intra Prediction Model) , LIC (Local Illumination Compensation) , TM (Template Matching) , OBMC (Overlapped Block Motion Compensation) , ARMC-TM (Adaptive Reordering of Merge Candidates with Template Matching) , MVD (Motion Vector Difference) sign prediction, Block Level Reference Picture List Reordering, Template Matching Based BCW (Bi-Prediction with CU-level Weight) Index Derivation for Merge Mode, or a combination thereof.

[0123] II. 1 Using Inner Product of Two Histograms to Determine On-Off Condition of Template-Based Methods

[0124] In one invention, the inner product of two normalized histograms collected from two specific regions is used to determine the on-off condition of TM tools. When the inner product value is smaller than a threshold, the TM tools can be disabled.

[0125] In one embodiment, a histogram is collected in a specific region (e.g. current CU, current template, etc. ) to represent the distribution of sample values, normalized sample values, gradient values or angular directions in such region and the magnitude of each bin in the histogram can be normalized by the sample number.

[0126] In one embodiment, the granularity of a histogram can be fixed (e.g. the sample values smaller than 10 and larger than or equal to 5 are collected in same histogram bin) or determined by the value distribution of the specific region or signalled in the bitstream at the frame / picture / slice / CTU / CU / PU level.

[0127] In one embodiment, the inner product can be computed by the histograms of reference template and current predictor, current template and current predictor, reference left and top template, current left and top template or any two specific regions.

[0128] In one embodiment, the inner product can be calculated on luma and / or chroma samples. The inner product calculated in a colour component can be used to guide the on-off condition of TM tools on other colour components.

[0129] In one embodiment, the threshold can be a fixed value, a value signalled in the bitstream at the frame / picture / slice / CTU / CU / PU level or a value depending on the QP value, CU size, POC distance between current and reference frame, distance between current and reference CU, CU position or any other information.

[0130] II. 2 Using Correlation Coefficient to Determine On-Off Condition of Template-Based Methods

[0131] In one embodiment, the correlation coefficient calculated from two specific regions is used to determine the on-off condition of TM tools. When the correlation coefficient value is smaller than a threshold, the TM tools can be disabled. The correlation coefficient can be calculated as follows. where r = correlation coefficient xi = value of a sample in first region = mean of the values in first region yi = value of a sample in second region = mean of the values in second region.

[0132] In one embodiment, the correlation coefficient can be calculated from sample values, normalized sample values, gradient values or angular directions in such region.

[0133] In one embodiment, the correlation coefficient can be computed by sampling the samples in reference template and current predictor, current template and current predictor, reference left and top template, current left and top template or any two specific regions.

[0134] In one embodiment, when the sample numbers in two specific regions are not aligned, sub-sampling process is performed to collect same number of samples in two regions for correlation coefficient calculation. In another embodiment, when the sample numbers in two specific regions are not aligned, up-sampling process is performed to collect same number of samples in two regions for correlation coefficient calculation. In another embodiment, when calculating the correlation coefficient between reference template and current predictor or current template and current predictor, only the predictors nearby the boundary of current CU are used to calculate the correlation coefficient.

[0135] In one embodiment, the correlation coefficient can be calculated on luma and / or chroma samples. The correlation coefficient calculated in a colour component can be used to guide the on-off condition of TM tools on other colour components.

[0136] In one embodiment, the threshold can be a fixed value, a value signalled in the bitstream at the frame / picture / slice / CTU / CU / PU level or a value depending on the QP value, CU size, POC distance between current and reference frame, distance between the current and reference CU, CU position or any other information.

[0137] II. 3 Using Histogram to Determine On-Off Condition of Template-Based Methods

[0138] In one invention, comparing the distributions between two histograms collected from two specific regions is used to determine the on-off condition of TM tools. When the similarity of distributions is small, the TM tools can be disabled.

[0139] In one embodiment, a histogram is collected in a specific region (e.g. current CU, current template, etc. ) to represent the distribution of sample values, normalized sample values, gradient values or angular directions in such region and the magnitude of each bin in the histogram can be normalized by the sample number.

[0140] In one embodiment, the first N bins of two histograms with larger values are used to determine the similarity of two histograms. If the difference of the first bin’s centres (i.e., the centre values of two bins with largest values in respective histograms) of two histograms is smaller than a threshold and the difference of second bin’s centres is smaller than a threshold and the differences of the rest of first N bin’s centres are all smaller than a threshold, the TM tools can be enabled.

[0141] In one embodiment, the first N bins of two histograms with larger values are used to determine the similarity of two histograms. If the difference of the first bin’s centres (i.e., the median values in the ranges of two bins with largest values in respective histograms) of two histograms is smaller than a threshold and the difference of second bin’s centres is smaller than a threshold and the differences of the rest of first N bin’s centres are all smaller than a threshold, the TM tools can be enabled. In another example, the mean / median value of the first N bin’s centres is calculated. If the difference of two mean / median values is smaller than a threshold, the TM tools are enabled.

[0142] In one embodiment, the sum of sample numbers in the first N histogram bins (denoted as Sf) or the sum of sample numbers in the maximum bin, and K bins neighbouring to the maximum bin (denoted as Sn) are calculated and used to determine the usage of TM tools. If the difference of the ratios of Sf or Sn to the total sample numbers in two specific regions is smaller than a threshold, the TM tools are enabled.

[0143] In one embodiment, the median / mean value and / or the variance calculated from sample values, normalized sample values, gradient values or angular directions in each specific region are used to determine the usage of TM tools. If the difference of median / mean values in two specific regions is smaller than a threshold and / or the difference of variance is smaller than a threshold, the TM tools are enabled. In another example, the mean / median value and / or the variance are calculated from the first N histogram bins with larger values.

[0144] In one embodiment, the ratio of the sum of sample numbers in first N histogram bins with larger values to sum of the sample numbers in first N histogram bins with smaller values are used to determine the usage of TM tools.

[0145] In one embodiment, the ratio of mean / median value of the first N largest bin’s centres to mean / median value of the first N smallest bin’s centres are used to determine the usage of TM tools.

[0146] II. 4 Extensions of Considering Spatial Similarity for Template-Based Methods

[0147] The template-based reordering, template-based refinement, or template-base fusion process of AMVP candidate, merge candidate, affine candidate, SbTMvP candidate, IBC candidate, MMVD candidate, MVD sign prediction, BCW index, LIC index, GPM partition, block-level reference picture, OBMC, inter prediction indicator, or other inter tools can be disabled when the inner product or correlation coefficient is lower than a threshold.

[0148] The template-based reordering, template-based refinement, or template-base fusion process of TIMD, DIMD, CCCM, GL-CCCM, intra prediction, intra chroma prediction, TMRL, or other intra tools can be disabled when the inner product or correlation coefficient is lower than a threshold.

[0149] In another embodiment, instead of disabling the entire template-based reordering, template-based refinement, or template-base fusion process, the template candidate set is reduced by considering inner product or correlation coefficient.

[0150] In one embodiment, when the inner product or correlation coefficient is lower than a threshold, the search range of TM search, the search range of intraTMP, the number of candidates of TIMD, DIMD, OBMC, TMRL, intra prediction fusion or any other coding tool can be reduced.

[0151] The similarity between the reference template and current predictor, current template and current predictor, reference left and top template, current left and top template or any two specific regions can be calculated by any other matrix instead of inner product or correlation coefficient.

[0152] Any of the foregoing proposed methods of determining the usage of template matching tools based on histograms can be applied independently or jointly. Moreover, any of the foregoing proposed methods can be implemented in encoders and / or decoders. For example, any of the proposed methods can be implemented in inter prediction module of an encoder and / or a decoder. Alternatively, any of the proposed methods can be implemented as a circuit coupled to inter prediction module of the encoder and / or the decoder.

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

[0154] Fig. 11 illustrates a flowchart of an exemplary video coding system that determines the usage of template matching tools based on two histograms derived from two specific regions according to an embodiment of the present invention. The steps shown in the flowchart may be implemented as program codes executable on one or more processors (e.g., one or more CPUs) at the encoder side. The steps shown in the flowchart may also be implemented based hardware such as one or more electronic devices or processors arranged to perform the steps in the flowchart. According to the method, input data associated with a current block is received in step 1110, wherein the input data comprises pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side. Two histograms are determined in steps 1120, wherein the two histograms are collected from two specific regions associated the current block. The template-based tool is applied to the current block depending on the two histogram in step 1130.

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

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

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

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

Claims

1.A method of video coding, the method comprising:receiving input data associated with a current block, wherein the input data comprises pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side;determining two histograms, wherein the two histograms are collected from two specific regions associated the current block; andapplying a template-based tool to the current block depending on the two histograms.2.The method of Claim 1, wherein if similarity between the two histograms is small, the template-based tool is disabled for the current block.3.The method of Claim 2, wherein the similarity between the two histograms is measured by using Sum of Absolute Differences (SAD) between the two histograms as a cost function.4.The method of Claim 1, wherein the two specific regions correspond to the current block and current template, wherein the current template refers to reconstruction samples adjacent to the current block.5.The method of Claim 1, wherein the two histograms correspond to distribution of sample values, median or mean value derived from the sample values, variance derived from the sample values, normalized sample values, gradient values or angular directions.6.The method of Claim 1, wherein the template-based tool comprises DIMD (Decoder-side Intra Mode Derivation) , TIMD (Template-based Intra Mode Derivation) , Intra Prediction Fusion, IntraTMP, TMRL (Template-based Multiple Reference Line) , CCCM (Convolutional Cross-Component Intra Prediction Model) , LIC (Local Illumination Compensation) , TM (Template Matching) , OBMC (Overlapped Block Motion Compensation) , ARMC-TM (Adaptive Reordering of Merge Candidates with Template Matching) , MVD (Motion Vector Difference) sign prediction, Block Level Reference Picture List Reordering, Template Matching Based BCW (Bi-Prediction with CU-level Weight) Index Derivation for Merge Mode, or a combination thereof.7.The method of Claim 1, wherein if a first difference between first centres of corresponding first bin of the two histograms is smaller than a threshold, a second difference between second centres of corresponding second bin of the two histograms is smaller than the threshold, remaining differences between remaining centres of corresponding remaining first N bins of the two histograms are all smaller than the threshold, or a combination thereof, the template-based tool is enabled.8.The method of Claim 1, wherein if similarity between the two histograms is small, the template-based tool is applied to the current block with a reduced template candidate set.9.The method of Claim 1, wherein if similarity between the two histograms is small, search range of template-matching based search or intraTMP associated with the template-based tool is reduced.10.The method of Claim 1, wherein if similarity between the two histograms is small, a number of candidates of TIMD (Template-based Intra Mode Derivation) , DIMD (Decoder-side Intra Mode Derivation) , OBMC (Overlapped Block Motion Compensation) , TMRL (Template-based Multiple Reference Line) , or intra prediction fusion is reduced.11.An apparatus for video coding, the apparatus comprising one or more electronics or processors arranged to:receive input data associated with a current block, wherein the input data comprises pixel data to be encoded at an encoder side or data associated with the current block to be decoded at a decoder side;determine two histograms, wherein the two histograms are collected from two specific regions associated the current block; andapply a template-based tool to the current block depending on the two histogram.

Citation Information

Patent Citations

  • Genetic markers and identification methods for identifying fish species of the genus Girella

    KR102654968B1

  • Methods and devices for decoder-side intra mode derivation

    WO2023129744A1

  • Region-based implicit intra mode derivation and prediction

    WO2023198105A1