Methods and apparatus of sample-based prediction refinement using template differences in video coding systems
By calculating sample-based prediction offsets using position-related weights, the method enhances prediction accuracy in video coding systems, addressing impairments in reconstructed video data and improving coding efficiency and quality.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- MEDIATEK INC
- Filing Date
- 2025-12-17
- Publication Date
- 2026-06-25
AI Technical Summary
Existing video coding systems, such as VVC, HEVC, and others, face challenges in refining prediction accuracy due to impairments in reconstructed video data during encoding and decoding processes, particularly in handling out-of-boundary prediction samples and illumination variations, which affect coding efficiency and quality.
The method involves deriving refined prediction using sample differences in a template area of the current block with position-related weighting, calculating sample-based prediction offsets (SPO) based on template differences and position-related weights (PRWs) to enhance prediction accuracy.
Improves prediction accuracy by refining prediction samples, leading to enhanced coding efficiency and video quality by addressing impairments in reconstructed video data.
Smart Images

Figure CN2025143173_25062026_PF_FP_ABST
Abstract
Description
METHODS AND APPARATUS OF SAMPLE-BASED PREDICTION REFINEMENT USING TEMPLATE DIFFERENCES IN VIDEO CODING SYSTEMSCROSS 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 / 736,002, filed on December 19, 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. In particular, the present invention relates to deriving refined prediction using sample differences in a template area of the current block with position-related weighting.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] Some related coding tools for VVC and HEVC are viewed as follows.
[0008] Enhanced Bi-Directional Motion Compensation
[0009] In bi-directional motion compensation, the out of boundary (OOB) prediction samples are discarded and only the non-OOB predictors, when available, are used to generate the final predictor. Specifically, let Pos_xi, j and Pos_yi, j denote the position of a prediction sample in the current block, and denote the MV of the current block; PosLeftBdry, PosRightBdry, PosTopBdry and PosBottomBdry are the positions of four boundaries of the picture. A prediction sample is regarded as OOB when at least one of the following conditions is satisfied: where half_pixel is equal to 8 that represents the half-pel sample distance in the 1 / 16-pel sample precision.
[0010] After examining the OOB condition for each sample, the final prediction samples of one bi-directional block are generated as follows:
[0011] OOB checking process is also applicable when BCW is enabled.
[0012] Finally, note this sample-adaptive bi-prediction process is only applied to prediction units for which at least a reference bock is first detected as partially or entirely out-of-bounds. Thus, a block-level OOB criteriion is first checked. If both prediction blocks are non-OOB, then the usual bi-prediction takes place.
[0013] Local Illumination Compensation (LIC)
[0014] LIC is an inter prediction technique to model local illumination variation between current block and its prediction block as a function of that between current block template and reference block template. The parameters of the function can be denoted by a scale α and an offset β, which forms a linear equation, that is, α*p [x] +β to compensate illumination changes, where p [x] is a reference sample pointed to by MV at a location x on 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 current block template and reference block template, no signalling overhead is required for them.
[0015] The local illumination compensation proposed in JVET-O0066 is used for inter-coded 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. · Samples of the reference block template are generated by using MC with the block MV without rounding it to integer-pel precision.
[0016] Combined Inter and Intra prediction (CIIP)
[0017] In VVC, when a CU is coded in merge Mode, if the CU contains at least 64 luma samples (that is, CU width times CU height is equal to or larger than 64) , and if both CU width and CU height are less than 128 luma samples, an additional flag is signalled to indicate if the combined inter / intra prediction (CIIP) mode is applied to the current CU. As its name indicates, the CIIP prediction combines an inter prediction signal with an intra prediction signal. The inter prediction signal in the CIIP mode Pinter is derived using the same inter prediction process applied to regular merge mode; and the intra prediction signal Pintra is derived following the regular intra prediction process with the planar mode. Then, the intra and inter prediction signals are combined using weighted averaging, where the weight value is calculated depending on the coding modes of the top and left neighbouring blocks (shown in Fig. 2) as follows: - If the top neighbour is available and intra coded, then set isIntraTop to 1, otherwise set isIntraTop to 0; - If the left neighbour is available and intra coded, then set isIntraLeft to 1, otherwise set isIntraLeft to 0; - If (isIntraLeft + isIntraTop) is equal to 2, then wt is set to 3; - Otherwise, if (isIntraLeft + isIntraTop) is equal to 1, then wt is set to 2; - Otherwise, set wt to 1.
[0018] The CIIP prediction is formed as follows: PCIIP= ( (4-wt) *Pinter+wt*Pintra+2) >>2.
[0019] Multi-Hypothesis Prediction (MHP)
[0020] In the multi-hypothesis inter prediction mode (JVET-M0425) , one or more additional motion-compensated prediction signals are signalled, in addition to the conventional bi-prediction signal. The resulting overall prediction signal is obtained by sample-wise weighted superposition. With the bi-prediction signal pbi and the first additional inter prediction signal / hypothesis h3, the resulting prediction signal p3 is obtained as follows: p3= (1-α) pbi+αh3.
[0021] The weighting factor α is specified by the new syntax element add_hyp_weight_idx, according to the following mapping table: Table 1. Mapping between syntax element add_hyp_weight_idx, and weighting factor α
[0022] Analogously to above, more than one additional prediction signal can be used. The resulting overall prediction signal is accumulated iteratively with each additional prediction signal. pn+1= (1-αn+1) pn+αn+1hn+1
[0023] The resulting overall prediction signal is obtained as the last pn (i.e., the pn having the largest index n) . Up to two additional prediction signals can be used (i.e., n is limited to 2) .
[0024] The motion parameters of each additional prediction hypothesis can be signalled either explicitly by specifying the reference index, the motion vector predictor index, and the motion vector difference, or implicitly by specifying a merge index. A separate multi-hypothesis merge flag distinguishes between these two signalling modes.
[0025] For inter AMVP mode, MHP is only applied if non-equal weight in BCW is selected in bi-prediction mode.
[0026] Combination of MHP and BDOF is possible, however the BDOF is only applied to the bi-prediction signal part of the prediction signal (i.e., the ordinary first two hypotheses) .
[0027] In the present invention, techniques for refining prediction are disclosed. In particular, the present invention discloses methods and apparatus for deriving refined prediction using sample differences in a template area of the current block with position-related weighting. BRIEF SUMMARY OF THE INVENTION
[0028] A method and apparatus of video coding using refined prediction are disclosed. According to the method, input data associated with a current block is received, wherein the input data comprise pixel data for the current block to be encoded at an encoder side or coded data associated with the current block to be decoded at a decoder side. One or more templates of the current block are determined. One or more sets of Position-Related Weights (PRWs) are determined for template samples in said one or more templates and prediction samples in the current block, wherein each weight of each set of said one or more sets of PRWs is dependent on a first position of a target template sample in said one or more templates and / or a second position of each of the prediction samples in the current block. An SPO (Sample-Based Prediction Offset) is derived for each of the prediction samples in the current block from a sum of template differences weighted by said one or more sets of respective PRWs, wherein the template differences are derived based on the template samples. The prediction samples are refined using the SPO to generate more accurate prediction samples. The current block is encoded or decoded by using the refined prediction samples.
[0029] In one embodiment, said one or more templates of the current block comprise an above template on a top side of the current block and a left template on a left side of the current block. In one embodiment, the SPO comprises a first part calculated for the above template using a first set of PRWs and a second part calculated for the left template using a second set of PRWs.
[0030] In one embodiment, the template differences comprise above differences and left differences, wherein each of the above differences is calculated from a reconstructed above sample and a reference above sample in the above template, and each of the left differences is calculated from a reconstructed left sample and a reference left sample in the left template.
[0031] In one embodiment, first PRWs for the above differences at different horizontal locations with a given vertical location are the same, and / or second PRWs for the left differences at different vertical locations with a given horizontal location are the same. In one embodiment, first PRWs for the above differences at different horizontal locations with a given vertical location are different, and / or second PRWs for the left differences at different vertical locations with a given horizontal location are different.
[0032] In one embodiment, an above bias term is added to a first sum of the above differences weighted by the first set of PRWs and a left bias term is added to a second sum of the left differences weighted by the second set of PRWs, and the first part for the SPO is calculated by right-shifting the first sum of the above differences by a shift value and the second part for the SPO is calculated by right-shifting the second sum of the left differences by the shift value. The first part for the SPO is calculated by right-shifting the first sum of the above differences by a shift value and the second part for the SPO is calculated by right-shifting the second sum of the left differences by the shift value.
[0033] In one embodiment, the above template comprises one or more first lines and / or the left template comprises one or more second lines. In one embodiment, the SPO for a target prediction sample in the current block is calculated from the sum of template differences at template locations associated with the target prediction sample, and wherein the template locations comprise first template locations associated with the target prediction sample and surrounding horizontal locations in said one or more first lines of the above template and / or second template locations associated with the target prediction sample and surrounding vertical locations in said one or more second lines of the left template.
[0034] In one embodiment, values of said one or more sets of PRWs for the prediction samples correspond to a decreasing geometric series with increasing distances of the prediction samples. In another embodiment, values of said one or more sets of PRWs for the prediction samples are inversely proportional to a square of distances of the prediction samples. In yet another embodiment, values of said one or more sets of PRWs for the prediction samples decrease as distances of the prediction samples increase. The distances of the prediction samples are distances between the prediction samples and a CU boundary.
[0035] In one embodiment, values of said one or more sets of PRWs are pre-defined and stored in one or more loop-up-tables.
[0036] In one embodiment, the SPO for a target prediction sample in the current block is calculated from the sum of template differences at template locations associated with the target prediction sample, and wherein the template locations comprise a first template location and surrounding horizontal locations in an above template and / or a second template location and surrounding vertical locations in a left template.BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Fig. 1A illustrates an exemplary adaptive Inter / Intra video encoding system incorporating loop processing.
[0038] Fig. 1B illustrates a corresponding decoder for the encoder in Fig. 1A.
[0039] Fig. 2 illustrates the top and left neighbouring blocks used in CIIP weight derivation.
[0040] Fig. 3A and Fig. 3B illustrate the vertical distance y and the horizontal distance x for deriving PRW.
[0041] Fig. 4 illustrates a flowchart of an exemplary video coding system that derives refined prediction using sample differences in a template area of the current block with position-related weighting.DETAILED DESCRIPTION OF THE INVENTION
[0042] 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.
[0043] 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.
[0044] PROPOSED METHOD
[0045] The proposed sample-based prediction refinement can be applied on any CU with inter modes or IBC modes whenever the top and / or left template area is ready.
[0046] Method 1: Only Using Above Template and Left Template
[0047] We derive a sample-based prediction offset to refine the predictor. In the first step, we calculate the template difference of above template Diffabove, i and 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 with respect 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 right next to the sample i = 0. Diffabove, i=Recabove, i-Refabove, i Diffleft, j=Recleft, j-Refleft, j
[0048] When the template is a single line, we can use the differences between samples in the reconstructed template and samples in the referenced template to derive the sample-based prediction offset (SPO) for each sample in the predictor. SPO can be derived using one of following equations:
[0049] For equation (1) , the position-related weighting, PRWabove, y and PRWleft, x, should be positive numbers which are smaller than 1 and larger than 0.
[0050] For equation (2) , the position-related weighting, PRWabove, y and PRWleft, x , should be positive integers. Compared to equation (1) , a bias term (i.e., Babove or Bleft) is added to the sum calculation, and the sum for the above template is right shifted by SSPO to derive the first SPO part associated with the above template and the sum for the left template is also right shifted by SSPO to derive the second SPO part associated with the left template. The total SPO corresponds to the sum of the first part SPO and the second part SPO.
[0051] Furthermore, for equations (1) and (2) , the summation for the above sample differences (i.e., Diffabove, i) is calculated over a range from (x-n) to (x+n) . In other words, the summation calculated includes the current sample at x and n neighbouring sample on each side. The summation for the left sample differences (i.e., Diffleft, j) is calculated over a range from (y-n) to (y+n) . In other words, the summation calculated includes the current sample at y and n neighbouring sample on each side.
[0052] The SSPO is a positive integer. The Babove and Bleft are integers. There are some common settings of Babove including 0, There are some common settings of Bleft including 0, and
[0053] OffsetSPO, x, y is the prediction offset of sample at position (x, y) in the predictor. PRWabove, y and PRWleft, x are the position-related weighting.
[0054] The y is the vertical distance between current sample in predictor and the closest sample in above template, which is illustrated in Fig. 3A and Fig. 3B. Similarly, the x is the horizontal distance between current sample in predictor and the closest sample in left template. Note that x≥1 and y≥1.
[0055] The n is a non-negative integer which is related to the number of template samples used to derive the prediction offset.
[0056] Alternatively, when the template are multiple lines, SPO can be derived using one of the following equations.
[0057] For equation (3) , the position-related weighting, PRWabove, y and PRWleft, x, should be positive numbers which are smaller than 1 and larger than 0.
[0058] For t equation (4) , the position-related weighting, PRWabove, y and PRWleft, x, should be positive integers.
[0059] The SSPO is a positive integer. The Babove and Bleft are integers. There are some common settings of Babove including 0 , There are some common settings of Bleft including 0, and T ,
[0060] The N is a positive integer which is larger than or equal to 1. When N is greater than 1, it implies more than one line is used for the template.
[0061] Moreover, there is a variant of equation (1) :
[0062] In equation (1) , the weighting (i.e., PRWabove, y) is the same for difference samples (i.e., Diffabove, i) at different horizontal locations on a same vertical location. However, in equation (5) , the (i.e., PRWabove, i-x, y) is allowed to be different for difference samples (i.e., Diffabove, i) at different horizontal locations on a same vertical location. Similar situation is applied to the left template.
[0063] Similarly, there is a variant of equation (2) :
[0064] Similarly, there is a variant of equation (3) :
[0065] Similarly, there is a variant of equation (4) :
[0066] At the final step, the SPO is added to the predictor for each sample. Predx, y=Predx, y+OffsetSPO, x, y.
[0067] Various embodiments of deriving position-related weighting (PRW) are described in the following section.
[0068] In the first embodiment, the position-based weighting of each sample in the predictor can be derived by a geometric series.
[0069] For equation (1) and equation (3) , the embodiment will be like this: PRWabove, 1= aabove PRWabove, y= PRWabove, y-1×rabove+babove. PRWleft, 1= aleft PRWleft, x= PRWleft, x-1×rleft+bleft.
[0070] The rabove and rleft are numbers which are smaller than 1 and larger than 0.
[0071] The aabove and aleft are numbers which are smaller than 1 and larger than 0.
[0072] The babove and bleft are numbers which are smaller than 1 and larger than or equal to 0.
[0073] For equation (2) and equation (4) , the embodiment will be like this: PRWabove, 1= aabove PRWabove, y= (PRWabove, y-1×rabove+BPRW) >>SSPO+babove. PRWleft, 1= aleft PRWleft, x= (PRWleft, x-1×rleft+BPRW) >>SSPO+bleft.
[0074] The SSPO is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0075] The rabove and rleft are integers which are smaller than and larger than 0.
[0076] The aabove and aleft are integers which are smaller than and larger than 0.
[0077] The babove and bleft are integers which are smaller than and larger than or equal to 0.
[0078] For equation (5) and equation (6) , the embodiment will be like this: PRWabove, i, 1 = aabove, i PRWabove, i, y= PRWabove, i, y-1×rabove, i+babove, i. PRWleft, 1, j= aleft, j PRWleft, x, j= PRWleft, x-1, j×rleft, j+bleft, j.
[0079] The rabove, i and rleft, j are numbers which are smaller than 1 and larger than 0.
[0080] The aabove, i and aleft, j are numbers which are smaller than 1 and larger than 0.
[0081] The babove, i and bleft, j are numbers which are smaller than 1 and larger than or equal to 0.
[0082] For equation (7) and equation (8) , the embodiment will be like this: PRWabove, i, 1= aabove, i PRWabove, i , y= (PRWabove, i , y-1×rabove, i+BPRW) >>SPRW+babove, i. PRWleft, 1, j= aleft, j PRWleft, x, j= (PRWleft, x-1, j×rleft, j+BPRW) >>SPRW+bleft, j.
[0083] The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0084] The rabove, i and rleft, j are integers which are smaller than and larger than 0.
[0085] The aabove, i and aleft, j are integers which are smaller than and larger than 0.
[0086] The babove, i and bleft, j are integers which are smaller than and larger than or equal to 0.
[0087] In another similar embodiment, the position-based weighting of each sample in the predictor could be derived by a geometric series
[0088] For equation (1) and equation (3) , the embodiment will be like this: PRWabove, 1= aabove PRWleft, 1= aleft
[0089] The h and w are height and width of current CU / PU. The rabove and rleft are numbers which are smaller than 1 and larger than 0.
[0090] The aabove and aleft are numbers which are smaller than 1 and larger than 0.
[0091] The babove and bleft are numbers which are smaller than 1 and larger than or equal to 0.
[0092] For equation (2) and equation (4) , the embodiment will be like this: PRWabove, 1= aabove PRWleft, 1= aleft
[0093] The h and w are height and width of current CU / PU. The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0, and
[0094] The rabove and rleft are integers which are smaller than and larger than 0.
[0095] The aabove and aleft are integers which are smaller than and larger than 0.
[0096] The babove and bleft are integers which are smaller than and larger than or equal to 0.
[0097] For equation (5) and equation (6) , the embodiment will be like this: PRWabove, i, 1= aabove, i PRWleft, 1, j= aleft, j
[0098] The h and w are height and width of current CU / PU.
[0099] The rabove, i and rleft, j are numbers which are smaller than 1 and larger than 0.
[0100] The aabove, i and aleft, j are numbers which are smaller than 1 and larger than 0.
[0101] The babove, i and bleft, j are numbers which are smaller than 1 and larger than or equal to 0.
[0102] For equation (7) and equation (8) , the embodiment will be like this: PRWabove, i, 1= aabove, i PRWleft, 1, j= aleft, j
[0103] The h and w are height and width of current CU / PU. The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0104] The rabove, i and rleft, j are integers which are smaller than and larger than 0.
[0105] The aabove, i and aleft, j are integers which are smaller than and larger than 0.
[0106] The babove, i and bleft, j are integers which are smaller than and larger than or equal to 0.
[0107] In another embodiment, the position-based weighting of each sample in the predictor should be inversely proportional to the square of the distance.
[0108] For equation (1) and equation (3) , the embodiment will be like this:
[0109] The aabove and aleft are numbers which are smaller than 1 and larger than 0.
[0110] For equation (2) and equation (4) , the embodiment will be like this:
[0111] The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0112] The aabove and aleft are integers which are smaller than and larger than 0.
[0113] For equation (5) and equation (6) , the embodiment will be like this:
[0114] The aabove, i and aleft, j are numbers which are smaller than 1 and larger than 0.
[0115] For equation (7) and equation (8) , the embodiment will be like this:
[0116] The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0117] The aabove, i and aleft, j are integers which are smaller than and larger than 0.
[0118] In another embodiment, the position-based weighting of each sample decreases linearly as the distance increases.
[0119] For equation (1) and equation (3) , the embodiment will be like this: PRWabove, y= max (0, aabove-mabove×y) PRWleft, x=max(0, aleft-mleft×x) .
[0120] The aabove and aleft are numbers which are smaller than 1 and larger than 0.
[0121] The mabove and mleft are positive numbers. mabove and mleft can be constants or parameters that are determined according to size of current PU.
[0122] For equation (2) and equation (4) , the embodiment will be like this: PRWabove, y= (max (0, aabove-mabove×y) +BPRW) >>SPRW PRWleft, x=(max(0, aleft-mleft×x)+BPRW)>>SPRW.
[0123] The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0124] The aabove and aleft are integers which are smaller than and larger than 0.
[0125] The mabove and mleft are positive integers. mabove and mleft can be constants or parameters that are determined according to size of current PU.
[0126] For equation (5) and equation (6) , the embodiment will be like this: PRWabove, i, y=aabove, i×Nk , where k=y / / M. PRWleft, x, j=aleft, j×Nl , where l=x / / M.
[0127] In the above equation, “ / / “represents for integer division.
[0128] The aabove, i and aleft, j are numbers which are smaller than 1 and larger than 0.
[0129] The N is a positive number which is larger than 0 and smaller than 1. The M is a positive integer.
[0130] For equation (7) and equation (8) , the embodiment will be like this: PRWabove, i, y= (aabove, i×Nk+BPRW) >>SPRW , where k=y / / M. PRWleft, x, j= (aleft, j×Nl+BPRW) >>SPRW , where l=x / / M.
[0131] The SPRW is a positive integer. The BPRW is an integer. There are some common settings of BPRW including 0 , and
[0132] The aabove, i and aleft, j are integers which are smaller than and larger than 0.
[0133] The N is a positive number which is larger than 0 and smaller than 1. The M is a positive integer.
[0134] In another embodiment, the position-based weighting of each sample in predictor could be derived from a pre-defined table.
[0135] For equations (1) , (2) , (3) and (4) , the embodiment will be like this: PRWabove, y= LUTabove (w, h, y) PRWleft, x= LUTleft (w, h, x) .
[0136] The values in the pre-defined table, LUTabove and LUTleft, are related to the width of CU / PU, height of CU / PU, and the distance from the CU / PU boundary.
[0137] For equations (5) , (6) , (7) and (8) , the embodiment will be like this: PRWabove, i, y= LUTabove, i (w, h, y) PRWleft, x, j= LUTleft, j (w, h, x)
[0138] The values in the pre-defined table, LUTabove and LUTleft, are related to the width of CU / PU, height of CU / PU, and the distance from the CU / PU boundary.
[0139] Method 2: Using Above Template, Left Template and Samples in Predictor
[0140] We derive a sample-based prediction offset to refine the predictor. In the first step, we calculate the template difference DiffTemp, x, y between the reconstructed template RecTemp, x, y of the current block and the reference template RefTemp, x, y of predictor. The x and y are the related positions with respect to the top-left (TL) sample in the predictor. For example, x = 0 and y = -1 means the template sample above the TL sample. DiffTemp, x, y=RecTemp, x, y-RefTemp, x, y
[0141] The position-based weighting of each sample in the predictor came from a pre-trained table LUTPRW, w, h, x, y, i, j according to the block width w and height h. The i and j are the related position with respect to the top-left (TL) sample in the predictor. For example, i = 1 and j = 0 means the sample right next to the TL sample.
[0142] The prediction offset of each sample OffsetSPO, i, j in the predictor is the sum of DiffTemp, x, y multiplied by LUTPRW, w, h, x, y, i, j
[0143] At the final step, the SPO is then added to the predictor for each sample. Predx, y=Predx, y+OffsetSPO, x, y.
[0144] Any of the foregoing proposed methods or combination thereof can be implemented in encoders and / or decoders. For example, any of the proposed methods of SPO 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.
[0145] With reference to 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 circuits coupled to the intra coding module at the decoder or the encoder. 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)) .
[0146] Fig. 4 illustrates a flowchart of an exemplary video coding system that derives refined prediction using sample differences in a template area of the current block with position-related weighting. 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 on 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 410, wherein the input data comprise pixel data for the current block to be encoded at an encoder side or coded data associated with the current block to be decoded at a decoder side. One or more templates of the current block are determined in step 420. One or more sets of Position-Related Weights (PRWs) are determined for template samples in said one or more templates and prediction samples in the current block in step 430, wherein each weight of each set of said one or more sets of PRWs is dependent on a first position of a target template sample in said one or more templates and / or a second position of each of the prediction samples in the current block. An SPO (Sample-Based Prediction Offset) is derived for each of the prediction samples in the current block from a sum of template differences weighted by said one or more sets of respective PRWs in step 440, wherein the template differences are derived based on the template samples. The prediction samples are refined using the SPO to generate refined prediction samples in step 450. The current block is encoded or decoded by using the refined prediction samples in step 460.
[0147] 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.
[0148] 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.
[0149] 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.
[0150] 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 comprise pixel data for the current block to be encoded at an encoder side or coded data associated with the current block to be decoded at a decoder side;determining one or more templates of the current block;determining one or more sets of Position-Related Weights (PRWs) for template samples in said one or more templates and prediction samples in the current block, wherein each weight of each set of said one or more sets of PRWs is dependent on a first position of a target template sample in said one or more templates and / or a second position of each of the prediction samples in the current block;deriving an SPO (Sample-Based Prediction Offset) for each of the prediction samples in the current block from a sum of template differences weighted by said one or more sets of respective PRWs, wherein the template differences are derived based on the template samples;refining the prediction samples using the SPO to generate refined prediction samples; andencoding or decoding the current block by using the refined prediction samples.2.The method of Claim 1, wherein said one or more templates of the current block comprise an above template on a top side of the current block and a left template on a left side of the current block.3.The method of Claim 2, wherein the SPO comprises a first part calculated for the above template using a first set of PRWs and a second part calculated for the left template using a second set of PRWs.4.The method of Claim 3, wherein the template differences comprise above differences and left differences, wherein each of the above differences is calculated from a reconstructed above sample and a reference above sample in the above template, and each of the left differences is calculated from a reconstructed left sample and a reference left sample in the left template.5.The method of Claim 4, wherein first PRWs for the above differences at different horizontal locations with a given vertical location are the same, and / or second PRWs for the left differences at different vertical locations with a given horizontal location are the same.6.The method of Claim 4, wherein first PRWs for the above differences at different horizontal locations with a given vertical location are different, and / or second PRWs for the left differences at different vertical locations with a given horizontal location are different.7.The method of Claim 4, wherein an above bias term is added to a first sum of the above differences weighted by the first set of PRWs and a left bias term is added to a second sum of the left differences weighted by the second set of PRWs, and the first part for the SPO is calculated by right-shifting the first sum of the above differences by a shift value and the second part for the SPO is calculated by right-shifting the second sum of the left differences by the shift value.8.The method of Claim 2, wherein the above template comprises one or more first lines and / or the left template comprises one or more second lines.9.The method of Claim 8, wherein the SPO for a target prediction sample in the current block is calculated from the sum of template differences at template locations associated with the target prediction sample, and wherein the template locations comprise first template locations associated with the target prediction sample and surrounding horizontal locations in said one or more first lines of the above template and / or second template locations associated with the target prediction sample and surrounding vertical locations in said one or more second lines of the left template.10.The method of Claim 1, wherein values of said one or more sets of PRWs for the prediction samples correspond to a decreasing geometric series with increasing distances of the prediction samples, and the distances of the prediction samples are distances between the prediction samples and a CU boundary.11.The method of Claim 1, wherein values of said one or more sets of PRWs for the prediction samples are inversely proportional to a square of distances of the prediction samples.12.The method of Claim 1, wherein values of said one or more sets of PRWs for the prediction samples decrease as distances of the prediction samples increase.13.The method of Claim 1, wherein values of said one or more sets of PRWs are pre-defined and stored in one or more loop-up-tables.14.The method of Claim 1, wherein the SPO for a target prediction sample in the current block is calculated from the sum of template differences at template locations associated with the target prediction sample, and wherein the template locations comprise a first template location and surrounding horizontal locations in an above template and / or a second template location and surrounding vertical locations in a left template.15.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 comprise pixel data for the current block to be encoded at an encoder side or coded data associated with the current block to be decoded at a decoder side;determine one or more templates of the current block;determine one or more sets of Position-Related Weights (PRWs) for template samples in said one or more templates and prediction samples in the current block, wherein each weight of each set of said one or more sets of PRWs is dependent on a first position of a target template sample in said one or more templates and / or a second position of each of the prediction samples in the current block;derive an SPO (Sample-Based Prediction Offset) for each of the prediction samples in the current block from a sum of template differences weighted by said one or more sets of respective PRWs, wherein the template differences are derived based on the template samples;refine the prediction samples using the SPO to generate refined prediction samples; andencode or decode the current block by using the refined prediction samples.