Method and apparatus of sample-based reference template refinement for candidate reordering using template difference

The method refines reconstructed reference samples within a reference template by calculating and applying weighted differences to enhance prediction accuracy and efficiency in video coding systems, addressing suboptimal video quality issues in existing systems.

WO2026233333A1PCT designated stage Publication Date: 2026-11-12MEDIATEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/095063
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-12
Filing Date
2026-05-07
Publication Date
2026-11-12

AI Technical Summary

Technical Problem

Existing video coding systems face challenges in refining reference templates for prediction, leading to suboptimal video quality due to impairments in reconstructed video data during processing.

Method used

A method and apparatus that refine reconstructed reference samples within a reference template by calculating differences between current and reference template samples, applying weighted combinations to derive target offsets, and using these offsets to enhance prediction refinement.

Benefits of technology

Improves video quality by enhancing prediction accuracy and efficiency in video coding systems, particularly in versatile video coding (VVC) standards, by utilizing refined reference templates for better prediction refinement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026095063_12112026_PF_FP_ABST
    Figure CN2026095063_12112026_PF_FP_ABST
Patent Text Reader

Abstract

A method and apparatus of refining reconstructed reference samples in a reference template are disclosed. According to one method, a current template area associated with the current block is identified, wherein the current template area including reconstructed current template samples. A reference template area of a reference block associated with the current block is identified, wherein the reference template area including reconstructed reference template samples. One or more differences between the reconstructed reference template samples and the reconstructed current template samples for a target position are calculated. A target offset for the target position is derived based on a weighted combination of the one or more differences. A target reference sample at the target position is refined utilising the target offset. A prediction for the current block is derived based on reconstructed reference samples in the reference template area comprising the refined target reference sample.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD AND APPARATUS OF SAMPLE-BASED REFERENCE TEMPLATE REFINEMENT FOR CANDIDATE REORDERING USING TEMPLATE DIFFERENCECROSS 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 / 801,226, filed on May 7, 2025 and U.S. Provisional Patent Application No. 63 / 804,013, filed on May 12, 2025. The U.S. Provisional Patent Applications are hereby incorporated by reference in their entireties.FIELD OF THE INVENTION

[0002] The present invention relates to video coding system that derives a prediction refinement based on weighted reconstructed samples in a reference template. In particular, the present invention relates to refining the reference template prior to be used to derive the prediction refinement.BACKGROUND

[0003] Versatile video coding (VVC) is the latest international video coding standard developed by the Joint Video Experts Team (JVET) of the ITU-T Video Coding Experts Group (VCEG) and the ISO / IEC Moving Picture Experts Group (MPEG) . The standard has been published as an ISO standard: ISO / IEC 23090-3: 2021, Information technology -Coded representation of immersive media -Part 3: Versatile video coding, published 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 some of the functional blocks as the encoder. For example, the decoder can reuse Inverse Quantization 124 and Inverse Transform 126; however, Transform 118 and Quantization 120 are not needed at the decoder. 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] In VVC, the Sequence Parameter Set (SPS) and the Picture Parameter Set (PPS) contain high-level syntax elements that apply to entire coded video sequences and pictures, respectively. The Picture Header (PH) and Slice Header (SH) contain high-level syntax elements that apply to a current coded picture and a current coded slice, respectively.

[0008] Various techniques for video coding developed for VVC, HEVC and the emerging new coding standard are reviewed as follow.

[0009] JVET-AJ2025: Adaptive Reordering of Merge Candidates with Template Matching (ARMC-TM)

[0010] The merge candidates are adaptively reordered with template matching (TM) . The reordering method is applied to regular merge mode, TM merge mode, and affine merge mode (excluding the subblock-based Temporal Motion Vector Prediction (sbTMVP) candidate) . For the TM merge mode, merge candidates are reordered before the refinement process.

[0011] An initial merge candidate list is firstly constructed according to given checking order, such as spatial Motion Vector Prediction (MVP) , Temporal MVPs (TMVPs) , non-adjacent, History-based MVPs (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 Decoder-side Motion Vector Refinement (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.

[0012] Cost Calculation

[0013] The template matching cost of a merge candidate during the reordering process is measured by the Sum of Absolute Transformed Differences (SATD) between samples of a template of the current block and their corresponding reference samples. The template comprises a set of reconstructed samples neighbouring to the current block. Reference samples of the template are located by the motion information of the merge candidate. When a merge candidate utilizes bi-directional prediction, the reference samples of the template of the merge candidate are also generated by bi-prediction as shown in Fig. 2. In Fig. 2, block 212 corresponds to a current block in current picture 210, blocks 222 and 232 correspond to reference blocks in reference pictures 220 and 230 in list 0 and list 1 respectively. Templates 214 and 216 are for current block 212, templates 224 and 226 are for reference block 222, and templates 234 and 236 are for reference block 232. Motion vectors 240, 242 and 244 are merge candidates in list 0 and motion vectors 260, 262 and 264 are merge candidates in list 1.

[0014] Refinement of the Initial Merge Candidate List

[0015] When multi-pass DMVR is used to derive the refined motion to the initial merge candidate list only the first pass (i.e., PU level) of multi-pass DMVR is applied in reordering. When template matching is used to derive the refined motion, the template size is set equal to 1. Only the above or left template is used during the motion refinement of TM when the block is flat with block width greater than 2 times of height or narrow with height greater than 2 times of width. TM is extended to perform 1 / 16-pel MVD (MV Difference) precision. The first four merge candidates are reordered with the refined motion in TM merge mode.

[0016] For subblock-based merge candidates with subblock size equal to Wsub × Hsub, the above template comprises several sub-templates with the size of Wsub × 1, and the left template comprises several sub-templates with the size of 1 × Hsub. As shown in Fig. 3, the motion information of the subblocks in the first row and the first column of current block is used to derive the reference samples of each sub-template. In Fig. 3, the motion information of the subblocks in the first row and the first column of current block is used to derive the reference samples of each sub-template. In Fig. 3, block 312 corresponds to a current block in current picture 310 and block 322 corresponds to a collocated block in reference picture 320.

[0017] Reordering Criteria

[0018] In the reordering process, a candidate is considered as redundant if the cost difference between a candidate and its predecessor is inferior to a lambda value e.g. |D1-D2| < λ, where D1 and D2 are the costs obtained during the first ARMC ordering and λ is the Lagrangian parameter used in the RD criterion at encoder side.

[0019] The proposed algorithm is defined as the following: - Determine the minimum cost difference between a candidate and its predecessor among all candidates in the list · If the minimum cost difference is superior or equal to λ, the list is considered diverse enough and the reordering stops. · If this minimum cost difference is inferior to λ, the candidate is considered as redundant, and it is moved at a further position in the list. This further position is the first position where the candidate is diverse enough compared to its predecessor. - The algorithm stops after a finite number of iterations (if the minimum cost difference is not inferior to λ) .

[0020] This algorithm is applied to the regular, TM, BM (Boundary Matching) and Affine merge modes. A similar algorithm is applied to the Merge MMVD and sign MVD prediction methods which also use ARMC for the reordering.

[0021] The value of λ is set equal to the λ of the rate distortion criterion used to select the best merge candidate at the encoder side for low delay configuration and to the value λ corresponding to another QP (Quantization Parameter) for Random Access configuration. A set of λ values corresponding to each signalled QP offset is provided in the SPS or in the Slice Header for the QP offsets which are not present in the SPS.

[0022] Extension to AMVP Modes

[0023] The ARMC design is also applicable to the AMVP (Adaptive MVP) mode wherein the AMVP candidates are reordered according to the TM cost. For the template matching for advanced motion vector prediction (TM-AMVP) mode, an initial AMVP candidate list is constructed, followed by a refinement from TM to construct a refined AMVP candidate list. In addition, an MVP candidate with a TM cost larger than a threshold, which is equal to five times of the cost of the first MVP candidate, is skipped.

[0024] Note, when wrap-around motion compensation is enabled, the MV candidate shall be clipped with wrap around offset taken into consideration.

[0025] MV Candidate Type Based ARMC

[0026] Merge candidates of one single candidate type, e.g., TMVP or non-adjacent MVP (NA-MVP) , are reordered based on the ARMC TM cost values. The reordered candidates are then added into the merge candidate list. The TMVP candidate type adds more TMVP candidates with more temporal positions and different inter prediction directions to perform the reordering and the selection. Moreover, NA-MVP candidate type is further extended with more spatially non-adjacent positions. The target reference picture of the TMVP candidate can be selected from any one of reference picture in the list according to scaling factor. The selected reference picture is the one whose scaling factor is the closest to 1.

[0027] Adaptive Cost Function Selection in Merge Mode

[0028] The merge index indicates the cost function that is used to refine the corresponding merge candidate in a merge list. Two cost functions are alternately selected for every other candidate in a merge list. If the merge index is an even number, the first cost function is selected for the refinement process, otherwise the second cost function is selected. The proposed method applies to regular merge mode, template matching merge mode, bilateral matching merge mode, and affine merge mode.

[0029] For bilateral matching merge and affine merge, the two cost functions are set to SATD and SAD. If the merge index is an even number, then SATD is selected, otherwise SAD is selected.

[0030] For the template matching merge, the two cost functions are set to weighted SAD and SAD. If the merge index is an even number, then weighted SAD is selected to refine the merge candidate; otherwise, SAD is selected.

[0031] TM Based Reordering for MMVD and Affine MMVD

[0032] The MMVD offsets are extended for MMVD and affine MMVD modes. Additional refinement positions along k×π / 8 diagonal angles are added shown in Fig. 4, thus increasing the number of directions from 4 to 16. In Fig. 4, additional directions along k×π / 8 diagonal angles (indicated by circles with a cross inside being used in the anchor) . Second, based on the SATD cost between the template (one row above and one column left to the current block) and its reference for each refinement position, all the possible MMVD refinement positions (16×6) for each base candidate are reordered. Finally, the top 1 / 8 refinement positions with the smallest template SATD costs are retained as available positions for subsequent MMVD index coding. The MMVD index is binarised by the Rice code with the parameter equal to 2. The affine MMVD reordering is extended, in which additional refinement positions along k×π / 4 diagonal angles are added. After reordering, top 1 / 2 refinement positions with the smallest template SATD costs are kept.

[0033] The first N motion candidates in the candidate list before being reordered are utilized as the base candidates for MMVD and affine MMVD. N is equal to 3 for MMVD, and [1, 3] depending on the neighbouring block affine flags for affine MMVD. Two ways of adding MMVD offsets are allowed, including the ‘two-side’a nd ‘one-side’ , depending on whether the offset of the other reference picture list is mirrored or directly set to zero. Which way is applied to one block is dependent on the TM cost.

[0034] Template Matching Based Reordering for GPM Split Modes

[0035] In template matching based reordering for GPM (Geometric Partitioning Mode) 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 ascending ordering 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.

[0036] 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 ascending order and marking the best 32 split modes as available split modes.

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

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

[0039] IBC Merge / AMVP List Construction

[0040] The IBC (Intra Block Copy) merge / AMVP list construction compared to VVC is modified as follows: · The reference area is extended to the whole reconstructed area. · Only if an IBC merge / AMVP candidate is valid, it can be inserted into the IBC merge / AMVP candidate list. · Above-right, bottom-left, and above-left spatial candidates (belonging to the adjacent spatial candidate category) and one pairwise average candidate can be added into the IBC merge / AMVP candidate list. · Template based adaptive reordering (ARMC-TM) is applied to the IBC merge list with the template cost calculated using SATD (Sum of Absolute Transformed Differences) . · Candidates from non-adjacent spatial neighbouring blocks (a. k. a., non-adjacent candidates) can be added to the candidate lists of IBC merge modes and IBC AMVP. These non-adjacent candidates are inserted immediately after the adjacent spatial candidates. In addition, temporal BV candidates are derived from collocated positions and shifted collocated positions in the collocated pictures. The temporal BV candidates are added to the list between the non-adjacent BV candidates and the HBVP candidates for both IBC merge and IBC AMVP. The same reference area of non-adjacent merge in the regular inter mode is reused for the IBC. · Auto-relocated block vector prediction (AR-BVP) candidates are added to the IBC merge and AMVP candidate list immediately after the HBVP candidates. As shown in Fig. 6, a guiding block vector BV0, 1 (i.e., an existing BVP already in the candidate list) associated with the current block B0 points to a reference block B1. If B1 has a BV denoted as BV1, 2 pointing to a reference block B2, then BV0, 2, given by BV0, 2 =BV0, 1 +BV1, 2, is defined as the AR-BVP, guided by BV0, 1. When deriving BVn, n+1 guided by BV0, n, all five positions including top-left (e.g., LT in Fig. 7) , top-right (e.g., RT in Fig. 7) , centre (e.g., Ctr in Fig. 7) , bottom-left (e.g., LB in Fig. 7) , and bottom-right (e.g., RB in Fig. 7) positions of Bn are checked to find BVn, n+1. · Restriction that adjacent spatial candidates cannot be used for the IBC merge of a 4x4 CU is removed

[0041] Chained Motion Vector Prediction (CMVP)

[0042] The chained motion vector prediction candidates are introduced as one of merge candidates and are inserted after HMVP candidates for the regular merge and TM merge modes. The CMVP shares a similar idea with the auto-relocated block vector prediction described in Enhanced Compression Model (ECM) Section 3.2.29.1: MVP Extension, and CMVP candidates are derived as the accumulation of the recursively traced MVs and BVs based on the pre-derived MVs. In the current design, CMVP candidates can be derived for each merge index and each reference picture list. The traceable reference pictures are restricted to the reference pictures in the reference picture list.

[0043] More additional CMVP candidates are added right before the zero padding candidates in the initial merge candidate list. Meanwhile, the maximum size of the initial merge candidate list is increased by 4. The maximum number of the candidates before the original CMVP candidates is kept unchanged.

[0044] When deriving the additional CMVP candidates, only the centre position of the current block is checked to find traced MVs or BVs.

[0045] TMVP candidates with MV scaled to the reference picture with index 0 are added if the existing TMVP candidates has non-zero reference index. The additional TMVP candidates are used to derive CMVP candidates. After TMVP and the related CMVP candidates are derived, ARMC reordering is performed. CMVP candidates are derived in BM merge mode as well.

[0046] In the present invention, methods and apparatus to derive a prediction refinement using weighted reconstructed samples within a reference template are disclosed, where the reconstructed reference samples in the reference template are refined prior to being used to derive the prediction refinement. BRIEF SUMMARY OF THE INVENTION

[0047] A method and apparatus of refining reconstructed reference samples in a reference template are disclosed. According to one method, input data associated with a current block is received, wherein the input data comprising pixel data for encoding the current block at an encoder or coded data for decoding the current block at a decoder. A current template area associated with the current block is identified, wherein the current template area including reconstructed current template samples. A reference template area of a reference block associated with the current block is identified, wherein the reference template area including reconstructed reference template samples. One or more differences between the reconstructed reference template samples and the reconstructed current template samples for a target position are calculated. A target offset for the target position is derived based on a weighted combination of the one or more differences. A target reference sample at the target position is refined utilising the target offset. A prediction for the current block is derived based on reconstructed reference samples in the reference template area comprising the refined target reference sample.

[0048] In one embodiment, the reference template area comprises an above reference template and a left reference template, and the current template area comprises an above current template and a left current template. In one embodiment, the one or more differences comprise: one or more above differences calculated using the reconstructed reference template samples from the above reference template and the reconstructed current template samples from the above current template; and one or more left differences calculated using the reconstructed reference template samples from the left reference template and the reconstructed current template samples from the left current template.

[0049] In one embodiment, a first target offset for a first target position with the above reference template is derived based on a first weighted combination of the one or more above differences and a second weighted combination of the one or more left differences; and a second target offset for a second target position within the left reference template is derived based on a third weighted combination of the one or more above differences and a fourth weighted combination of the one or more left differences. In one embodiment, in response to a determination that a reconstructed sample within the above reference template, the left reference template, the above current template, or the left current template is unavailable, a difference associated with the unavailable reconstructed sample is set to zero or the refining of the target reference sample is bypassed. In one embodiment, in response to a determination that a reconstructed sample within the above reference template, the left reference template, the above current template, or the left current template is unavailable, the reconstructed sample is padded.

[0050] In one embodiment, a first target offset for a first target position with the above reference template is derived based on a first weighted combination of the one or more above differences; and a second target offset for a second target position within the left reference template is derived based on a second weighted combination of the one or more left differences.

[0051] In one embodiment, the one or more differences are smoothed utilising weighed averaging prior to deriving the target offset.

[0052] In one embodiment, generating the prediction is applied to the current block when the current block is coded in a mode selected from a group consisting of: Regular merge mode, Template Matching (TM) merge mode, Bilateral Matching (BM) merge mode, Merge mode with Motion Vector Difference (MMVD) , Affine Merge mode, Affine MMVD mode, Affine Geometric Partitioning Mode (GPM) mode, GPM mode, Combined Inter-Intra Prediction (CIIP) mode, CIIP TM mode, subblock-based Temporal Motion Vector Prediction (sbTMVP) , Advanced Motion Vector Prediction (AMVP) , Affine AMVP, AMC GPM mode, Intra Block Copy (IBC) AMVP, IBC merge mode, IBC merge mode with block vector differences (IBC-MBVD) , RR-IBC, IBC GPM mode, Intra Template Matching Prediction (IntraTMP) , Most Probable Mode (MPM) , TIMD, TIMD merge mode, Extrapolated Intra Prediction (EIP) merge mode, Spatial GPM (SGPM) , Chroma TMRL, Cross-Component Prediction (CCP) merge mode, and Distance-Derivation CCP (DDCCP) .

[0053] In one embodiment, the refined reference template area is further utilized for candidate reordering based on a template matching cost, and wherein a cost function for determining the template matching cost is selected from a group consisting of: Sum of Absolute Differences (SAD) , Mean-Removed SAD (MRSAD) , Sum of Squared Errors (SSE) , Mean-Removed SSE, Sum of Absolute Transformed Differences (SATD) , and Mean-Removed SATD.BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0056] Fig. 2. illustrates an example of template and reference samples of the template in reference pictures for adaptive reordering of merge candidates with template matching (ARMC-TM) .

[0057] Fig. 3 illustrates an example of template and reference samples of the template for block with sub-block motion using the motion information of the subblocks of the current block.

[0058] Fig. 4 illustrates additional directions along k×π / 8 diagonal angles (circles with a cross inside used in the anchor) .

[0059] Fig. 5 illustrates an example of an edge on templates

[0060] Fig. 6 illustrates an example of Auto-Relocated Block Vector Prediction (AR-BVP) derivation.

[0061] Fig. 7 illustrates an examples of five positions in Bn (n is set to 1) to be checked to find BVn, n+1.

[0062] Fig. 8 illustrates a flowchart of an exemplary video coding system that derives refined reconstructed samples within a reference template and then utilises the refined reconstructed reference template to derive a prediction according to an embodiment of the present invention.DETAILED DESCRIPTION OF THE INVENTION

[0063] 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.

[0064] 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.

[0065] One skilled in the art would understand that any of the following proposed methods (for example, in the sections 1 to 3) or their combination can be implemented individually or jointly in a video coding system. In this contribution, we propose several methods for refining reference templates that are used in candidate reordering. We derive the refinement that would be applied to reference template according to the difference between current template and reference template.

[0066] Our proposed methods are composed of three parts. The first part enumerates various numerical models used for deriving refinement that would be applied to reference template. The second part lists various coding tools that can be supported by our proposed methods. The third part list various criterion of cost functions that can be supported by our proposed methods. We will explain the corresponding possible embodiments for each part in following sections. By selecting one possible embodiment from each part, we can form a proposed method.

[0067] 1. Numerical Models for Refinement

[0068] 1.1. Using Both Above and Left Template Differences

[0069] Specifically, the refinement is essentially a sample-based offset applied to the reference template. We derive a sample-based offset to refine the top reference template or the left reference template. In the first step, we calculate the template difference of the above template Diffabove, i and the left template Diffleft, j between the reconstructed templates (Recabove, i and Recleft, j) of the current block and the reference template (Refabove, i and Refleft, j) of the predictor. The i and j are the related horizontal and vertical positions to the top-left (TL) sample in the predictor. For example, i = 0 means the template sample above the TL sample and i = 1 means the template sample immediately next to the sample i = 0. Diffabove, i=Recabove, i-Refabove, i , Diffleft, j=Recleft, j-Refleft, j.

[0070] In the second step, we apply a smoothing filter to the difference of the above template Diffabove, i and the left template Diffleft, j. Note that the second step is not necessary and can be skipped if desired. Specifically, by performing weighted averaging on the neighbouring template differences, we can obtain the smoothed result. For example: where Q is a positive integer, and

[0071] In the third step, we obtain the position-based weight of each sample. The position-based weight of each sample can be obtained from pre-trained tables LUTabove, w, h, i, j and LUTleft, w, h, i, j according to the block width w and height h. The i and j are horizontal and vertical positions relative to the top-left (TL) sample in the predictor.

[0072] The refinement for each sample Offseti, j is the sum of Diffabove, i, j multiplied by LUTabove, w, h, i, j and Diffleft, i, j multiplied by LUTleft, w, h, i, j. Assume the template size is M, where M is a positive integer and N is a non-negative integer, we can derive the refinement for the above template by following equation:

[0073] We can derive the refinement for the left template according to the following equation: where Shiftabove and Shiftleft are integers greater than or equal to 0. Shiftabove and Shiftleft can be two different values or the same value. We can explicitly signal the values of Shiftabove and Shiftleft at the sequence level or picture level or CTU level. Besides, we can implicitly derive the values of Shiftabove and Shiftleft according to some coding parameters that are available at decoder side.

[0074] In case the above reference template or above current template are not available, we can substitute Diff′abovewith 0 into the above-mentioned equations or simply don’ t apply any refinement on the above reference template and the left reference template.

[0075] In case the left reference template or the left current template is not available, we can substitute Diff′left with 0 into the above-mentioned equations or simply don’ t apply any refinement on the above reference template and the left reference template.

[0076] 1.2. Using Above / Left Template Differences to Derive Refinements for Above / Left Reference Template Respectively

[0077] The way of computing the template difference is the same as we mentioned in Section 1.1. The way of deriving the refinement is different. In this embodiment, we only use above template differences to derive the refinement for the above reference template and use the left template difference to derive the refinement for the left reference template.

[0078] We can derive the refinement for the above template according to the following equation:

[0079] We can derive the refinement for left template by following equation: where Shiftabove and Shiftleft are integers greater than or equal to 0. Shiftabove and Shiftleft can be two different values or the same value. We can explicitly signal the values of Shiftabove and Shiftleft at the sequence level or picture level or CTU level. Besides, we can implicitly derive the values of Shiftabove and Shiftleft according to some coding parameters that are available at the decoder side.

[0080] In case the above reference template or the above current template is not available, Offsetabove, i, j is set as 0.

[0081] In case that the left reference template or the left current template is not available, Offsetleft, i, j is set as 0.

[0082] 1.3. Using Left Template Difference to Derive Refinement for Above Reference Template and Using Above Template Difference to Derive Refinement For Left Reference Template

[0083] The way of computing template difference is the same as we mentioned in Section 1.1. The way of deriving the refinement is different. In this embodiment, we only use the left template difference to derive the refinement for the above reference template and use the above template difference to derive the refinement for the left reference template.

[0084] We can derive the refinement for the above template according to the following equation:

[0085] We can derive the refinement for the left template according to the following equation: where Shiftabove and Shiftleft are integers greater than or equal to 0. Shiftabove and Shiftleft can be two different values or the same value. We can explicitly signal the values of Shiftabove and Shiftleft at the sequence level or picture level or CTU level. Besides, we can implicitly derive the values of Shiftabove and Shiftleft according to some coding parameters that are available at the decoder side.

[0086] In case that the above reference template or the above current template is not available, Offsetleft, i, j is set as 0.

[0087] In case that the left reference template or the left current template is not available, Offsetabove, i, j is set as 0.

[0088] 1.4. Using different Equations to Derive Sample-Based Offset for Both Templates Available and Only One Template Available

[0089] When both the above template and the left template are available, we use the following equations to derive the sample-based offset for refining the above reference template and the left reference template:

[0090] When only the above template is available, we use the following equations to derive the sample-based offset for refining the above reference template and the left reference template: Offsetleft, i, j=0

[0091] When only the left template is available, we use the following equations to derive the sample-based offset for refining the above reference template and the left reference template: Offsetabove, i, j=0 where Shiftabove and Shiftleft are integers greater than or equal to 0. Shiftabove and Shiftleft can be two different values or the same value. We can explicitly signal the values of Shiftabove and Shiftleft at the sequence level or picture level or CTU level. Besides, we can implicitly derive the values of Shiftabove and Shiftleft according to some coding parameters that are available at the decoder side.

[0092] 2. Coding Tools Supported by The Proposed Methods

[0093] In this section, we will list all the coding tools that can be supported by our proposed methods. Our proposed methods can be applied to all the coding tools mentioned in this section or only to some of them. Coding tools that can be supported by our proposed methods are listed below: 1. Regular merge mode 2. TM merge mode 3. BM merge mode 4. MMVD 5. Affine Merge mode 6. Affine MMVD mode 7. Affine GPM mode 8. GPM mode 9. CIIP mode 10. CIIP TM mode 11. sbTMVP 12. AMVP 13. Affine AMVP 14. AMC (Affine Motion Compensation) GPM mode 15. IBC AMVP 16. IBC merge mode 17. IBC merge mode with block vector differences (IBC-MBVD)  18. RR-IBC 19. IBC GPM mode 20. IntraTMP 21. MPM 22. TIMD 23. TIMD merge mode 24. EIP merge mode 25. SGPM 26. Chroma TMRL 27. CCP merge mode 28. DDCCP 29. non-CCP chroma mode

[0094] 3. Cost Functions Supported by the Proposed Methods

[0095] During candidate reordering, the sorting will be based on the value of the template matching cost. The following cost functions can be supported by the proposed methods: 1. SAD 2. Mean removal SAD (MRSAD) 3. SSE 4. Mean removal SSE 5. SATD 6. Mean removal SATD

[0096] Any of the foregoing proposed methods or combination thereof can be implemented in encoders and / or decoders. For example, any of the proposed methods or combination thereof can be implemented in an inter / intra / IBC / prediction / transform module of an encoder and / or decoder. Alternatively, any of the proposed methods or combination thereof can be implemented as a circuit coupled to an inter / intra / IBC / prediction / transform module of the encoders and / or decoder, so as to provide the information needed by the inter / intra / IBC / prediction / transform module used in encoders and / or decoder. The proposed aspects, methods, related embodiments, and combination thereof can be implemented individually or jointly in a video coding system.

[0097] Any of the foregoing proposed methods refining reconstructed reference samples can be implemented in encoders and / or decoders. For example, any of the proposed methods of refining reconstructed reference samples and further being used for prediction refinement can be implemented in one module of an encoder and / or decoder. Alternatively, any of the proposed methods or combination thereof can be implemented as a circuit coupled to one module of the encoder and / or decoder, so as to provide the information needed by the module used in the encoder and / or decoder. The proposed aspects, methods and related embodiments, and combination thereof can be implemented individually or jointly in a video coding system.

[0098] With reference to the exemplary encoder and decoder in Fig. 1A and Fig 1B, the proposed methods can be implemented in the inter prediction modules. For example, in the encoder side, the required processing can be implemented as part of the Inter-Pred. unit 112 as shown in Fig. 1A. However, the encoder may also use additional processing unit to implement the required processing. For the decoder side, the required processing can be implemented as part of the MC unit 152 as shown in Fig. 1B. However, the decoder may also use additional processing unit to implement the required processing. Alternatively, any of the proposed methods can be implemented as a circuit coupled to the inter prediction module of the encoder and / or the inter / intra / prediction module of the decoder, so as to provide the information needed by the inter / prediction module. While the Inter-Pred. 112 in the encoder side and MC 152 in the decoder side 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) ) .

[0099] Fig. 8 illustrates a flowchart of an exemplary video coding system that derives refined reconstructed samples within a reference template and then utilises the refined reconstructed reference template to derive a prediction 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 one method, input data associated with a current block is received in step 810, wherein the input data comprising pixel data for encoding the current block at an encoder or coded data for decoding the current block at a decoder. A current template area associated with the current block is identified in step 820, wherein the current template area including reconstructed current template samples. A reference template area of a reference block associated with the current block is identified in step 830, wherein the reference template area including reconstructed reference template samples. One or more differences between the reconstructed reference template samples and the reconstructed current template samples for a target position are calculated in step 840. A target offset for the target position is derived based on a weighted combination of the one or more differences in step 850. A target reference sample at the target position is refined utilising the target offset in step 860. A prediction for the current block is derived in step 870 based on reconstructed reference samples in the reference template area comprising the refined target reference sample.

[0100] 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.

[0101] 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.

[0102] 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.

[0103] 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 comprising pixel data for encoding the current block at an encoder or coded data for decoding the current block at a decoder;identifying a current template area associated with the current block, wherein the current template area including reconstructed current template samples;identifying a reference template area of a reference block associated with the current block, wherein the reference template area including reconstructed reference template samples;calculating one or more differences between the reconstructed reference template samples and the reconstructed current template samples for a target position;deriving a target offset for the target position based on a weighted combination of the one or more differences;refining a target reference sample at the target position utilising the target offset; andgenerating a prediction for the current block based on reconstructed reference samples in the reference template area comprising the refined target reference sample.2.The method Claim 1, wherein the reference template area comprises an above reference template and a left reference template, and the current template area comprises an above current template and a left current template.3.The method Claim 2, wherein the one or more differences comprise: one or more above differences calculated using the reconstructed reference template samples from the above reference template and the reconstructed current template samples from the above current template; and one or more left differences calculated using the reconstructed reference template samples from the left reference template and the reconstructed current template samples from the left current template.4.The method of Claim 3, wherein a first target offset for a first target position with the above reference template is derived based on a first weighted combination of the one or more above differences and a second weighted combination of the one or more left differences; and a second target offset for a second target position within the left reference template is derived based on a third weighted combination of the one or more above differences and a fourth weighted combination of the one or more left differences.5.The method of Claim 4, wherein, in response to a determination that a reconstructed sample within the above reference template, the left reference template, the above current template, or the left current template is unavailable, a difference associated with the unavailable reconstructed sample is set to zero or the refining of the target reference sample is bypassed.6.The method of Claim 4, wherein, in response to a determination that a reconstructed sample within the above reference template, the left reference template, the above current template, or the left current template is unavailable, the reconstructed sample is padded.7.The method of Claim 3, wherein a first target offset for a first target position with the above reference template is derived based on a first weighted combination of the one or more above differences; and a second target offset for a second target position within the left reference template is derived based on a second weighted combination of the one or more left differences.8.The method Claim 1, wherein the one or more differences are smoothed utilising weighed averaging prior to deriving the target offset.9.The method Claim 1, wherein generating the prediction is applied to the current block when the current block is coded in a mode selected from a group consisting of: Regular merge mode, Template Matching (TM) merge mode, Bilateral Matching (BM) merge mode, Merge mode with Motion Vector Difference (MMVD) , Affine Merge mode, Affine MMVD mode, Affine Geometric Partitioning Mode (GPM) mode, GPM mode, Combined Inter-Intra Prediction (CIIP) mode, CIIP TM mode, subblock-based Temporal Motion Vector Prediction (sbTMVP) , Advanced Motion Vector Prediction (AMVP) , Affine AMVP, AMC GPM mode, Intra Block Copy (IBC) AMVP, IBC merge mode, IBC merge mode with block vector differences (IBC-MBVD) , RR-IBC, IBC GPM mode, Intra Template Matching Prediction (IntraTMP) , Most Probable Mode (MPM) , TIMD, TIMD merge mode, Extrapolated Intra Prediction (EIP) merge mode, Spatial GPM (SGPM) , Chroma TMRL, Cross-Component Prediction (CCP) merge mode, and Distance-Derivation CCP (DDCCP) .10.The method Claim 1, wherein the refined reference template area is further utilized for candidate reordering based on a template matching cost, and wherein a cost function for determining the template matching cost is selected from a group consisting of: Sum of Absolute Differences (SAD) , Mean-Removed SAD (MRSAD) , Sum of Squared Errors (SSE) , Mean-Removed SSE, Sum of Absolute Transformed Differences (SATD) , and Mean-Removed SATD.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 comprising pixel data for encoding the current block at an encoder or coded data for decoding the current block at a decoder;identify a current template area associated with the current block, wherein the current template area including reconstructed current template samples;identify a reference template area of a reference block associated with the current block, wherein the reference template area including reconstructed reference template samples;calculate one or more differences between the reconstructed reference template samples and the reconstructed current template samples for a target position;derive a target offset for the target position based on a weighted combination of the one or more differences;refine a target reference sample at the target position utilising the target offset; andgenerate a prediction for the current block based on reconstructed reference samples in the reference template area comprising the refined target reference sample.