Prediction method, video coder, and apparatus

The proposed prediction method addresses discrepancies and diversity issues in existing video coding technologies by using CRS-derived modes and TIMD fusion, resulting in improved accuracy and reduced redundancy.

WO2026085784A1PCT designated stage Publication Date: 2026-04-30SHENZHEN TCL NEW-TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SHENZHEN TCL NEW-TECH CO LTD
Filing Date
2024-10-23
Publication Date
2026-04-30

AI Technical Summary

Technical Problem

Existing image processing technologies, such as H.266/Versatile Video Coding (VVC) and Enhanced Compression Model (ECM), face issues with template-based prediction methods due to discrepancies in reference samples and lack of diversity, leading to accuracy problems, complexity, and encoding redundancy.

Method used

A prediction method that includes determining reference samples and templates, using common reference sample (CRS)-derived modes, and applying template-based intra mode derivation (TIMD) fusion, with or without CRS, to generate predictors, and deriving virtual intra prediction modes (VIPM) using an adjustment histogram of gradients (HoG)-based method.

Benefits of technology

Improves prediction accuracy and reduces encoding redundancy by utilizing diverse reference samples and advanced prediction methods, enhancing video coding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024126879_30042026_PF_FP_ABST
    Figure CN2024126879_30042026_PF_FP_ABST
Patent Text Reader

Abstract

A prediction method, a video coder, and an apparatus are disclosed. The prediction method applied to a video coder includes determining at least one reference sample and at least one template, wherein the at least one reference sample is the same as at least one sample used for prediction of a current block and generating at least one predictor on the at least one template from the at least one reference sample with an intra prediction mode (IPM) using at least one common reference sample (CRS).
Need to check novelty before this filing date? Find Prior Art

Description

PREDICTION METHOD, VIDEO CODER, AND APPARATUSTECHNICAL FIELD

[0001] The present disclosure relates to the field of image processing technologies, and more particularly, to a prediction method, a video coder, and an apparatus.BACKGROUND

[0002] In prior art systems like H. 266 / Versatile Video Coding (VVC) and Enhanced Compression Model (ECM) , regular intra prediction modes (IPM) use neighboring samples for prediction, including planar, DC, and angular modes. However, template-based prediction methods face two issues: the reference samples used in the template often differ from those used in the current block, leading to accuracy discrepancies, especially with larger templates. Additionally, template predictions often lack diversity, as current methods produce similar results.

[0003] The current image processing cannot work well due to complexity, large signaling overhead, and cause some encoding redundancy. Therefore, there is a need for a prediction method, a video coder, and an apparatus, which can solve issues in the prior art and / or other issues.SUMMARY

[0004] An object of the present disclosure is to propose a prediction method, a video coder, and an apparatus, which can solve issues in the prior art and / or other issues.

[0005] In a first aspect of the present disclosure, a prediction method applied to a video coder includes determining at least one reference sample and at least one template, wherein the at least one reference sample and the at least one template are defined by a reference line of a current block and generating at least one predictor on the at least one template based on the at least one reference sample.

[0006] In a second aspect of the present disclosure, a prediction method applied to a video coder includes using at least one common reference sample (CRS) -derived mode and / or at least one non-CRS method to generate at least one predictor for a current block, generating at least one prediction block based on at least one template from a most probable mode (MPM) list, and / or adding the at least one CRS-derived mode to at least one candidate list of a prediction mode.

[0007] In a third aspect of the present disclosure, a prediction method applied to a video coder includes decoding at least one block coded in a template-based intra mode derivation (TIMD) fusion, with or without at least one common reference sample (CRS) , and / or a spatial geometry partition mode (SGPM) to obtain a prediction block, and deriving a virtual intra prediction mode (VIPM) from the prediction block using an adjustment histogram of gradients (HoG) -based method.

[0008] In a fourth aspect of the present disclosure, a video coder includes a memory, a transceiver, and a processor coupled to the memory and the transceiver. The processor is configured to perform the above prediction method.

[0009] In a fifth aspect of the present disclosure, a non-transitory machine-readable storage medium has stored thereon instructions that, when executed by a computer, cause the computer to perform the above method.

[0010] In a sixth aspect of the present disclosure, a chip includes a processor, configured to call and run a computer program stored in a memory, to cause a device in which the chip is installed to execute the above method.

[0011] In a seventh aspect of the present disclosure, a computer readable storage medium, in which a computer program is stored, causes a computer to execute the above method.

[0012] In an eighth aspect of the present disclosure, a computer program product includes a computer program, and the computer program causes a computer to execute the above method.

[0013] In a ninth aspect of the present disclosure, a computer program causes a computer to execute the above method.BRIEF DESCRIPTION OF DRAWINGS

[0014] In order to illustrate the embodiments of the present disclosure or related art more clearly, the following figures will be described in the embodiments are briefly introduced. It is obvious that the drawings are merely some embodiments of the present disclosure, a person having ordinary skill in this field can obtain other figures according to these figures without paying the premise.

[0015] FIG. 1 is a block diagram illustrating an example of a video encoding system.

[0016] FIG. 2 is a block diagram illustrating an example of a video decoding system.

[0017] FIG. 3 is a schematic diagram illustrating an example of generation of a predictor of a current block using a planar mode.

[0018] FIG. 4 is a schematic diagram illustrating an example of generation of a predictor of a current block using an angular mode.

[0019] FIG. 5 is a schematic diagram illustrating an example of generation of a main reference line.

[0020] FIG. 6 is a schematic diagram illustrating an example of a use of template-based intra mode derivation (TIMD) to derive an intra prediction mode for a current block.

[0021] FIG. 7 is a schematic diagram illustrating an example of a template-based intra mode derivation (TIMD) fusion with a non-angular predictor.

[0022] FIG. 8A is a schematic diagram illustrating at least one definition of at least one reference sample R (-1, y) and R (x, -1) for applying position-dependent intra prediction combination (PDPC) to at least one angular mode.

[0023] FIG. 8B is a schematic diagram illustrating at least one definition of at least one reference sample R (-1, y) and R (x, -1) for applying PDPC to at least one angular mode.

[0024] FIG. 8C is a schematic diagram illustrating at least one definition of at least one reference sample R (-1, y) and R (x, -1) for applying PDPC to at least one angular mode.

[0025] FIG. 8D is a schematic diagram illustrating at least one definition of at least one reference sample R (-1, y) and R (x, -1) for applying PDPC to at least one angular mode.

[0026] FIG. 9 is a schematic diagram illustrating a given prediction direction for a bottom-left sample within a prediction block.

[0027] FIG. 10 is a flowchart illustrating an example of rules of PDPC application in an angular prediction.

[0028] FIG. 11 is a flowchart illustrating an example of decoding process for existing technologies TIMD.

[0029] FIG. 12 is a flowchart illustrating an example of procedure for generating predictors for each regular intra prediction mode (IPM) on templates.

[0030] FIG. 13 is a flowchart illustrating an example of a decoding process for a virtual intra prediction mode (VIPM) in TIMD and spatial geometry partition mode (SGPM) .

[0031] FIG. 14A is a flowchart illustrating a prediction method applied to a video coder according to an embodiment of the present disclosure.

[0032] FIG. 14B is a flowchart illustrating procedures for template-based prediction with common reference sample (CRS) according to an embodiment of the present disclosure.

[0033] FIG. 15A is a flowchart illustrating a prediction method applied to a video coder according to an embodiment of the present disclosure.

[0034] FIG. 15B is a flowchart illustrating a prediction method using CRS-derived modes to generate predictor for the current block according to an embodiment of the present disclosure.

[0035] FIG. 16 is a flowchart illustrating a decoding process for adding CRS-derived modes to Occurrence-based intra coding (OBIC) occurrence histogram according to an embodiment of the present disclosure.

[0036] FIG. 17 is a flowchart illustrating a decoding process for adding CRS-derived modes to the SGPM mode candidate list according to an embodiment of the present disclosure.

[0037] FIG. 18A is a flowchart illustrating a prediction method applied to a video coder according to an embodiment of the present disclosure.

[0038] FIG. 18B is a flowchart illustrating a prediction method using an adjustment histogram of gradients (HoG) -based method according to an embodiment of the present disclosure.

[0039] FIG. 19 is a schematic diagram illustrating locations of reference samples and templates according to an embodiment of the present disclosure.

[0040] FIG. 20 is a schematic diagram illustrating locations of reference samples and templates according to an embodiment of the present disclosure.

[0041] FIG. 21 is a schematic diagram illustrating locations of reference samples and templates according to an embodiment of the present disclosure.

[0042] FIG. 22 is a schematic diagram illustrating locations of reference samples and templates according to an embodiment of the present disclosure.

[0043] FIG. 23 is a schematic diagram illustrating a CRS planar prediction according to an embodiment of the present disclosure.

[0044] FIG. 24 is a schematic diagram illustrating reference samples above a current block and a portion of the samples to their right used in a main reference line according to an embodiment of the present disclosure.

[0045] FIG. 25 is a schematic diagram illustrating reference samples above a left template and a current block as well as a portion of the samples to their right used in a main reference line according to an embodiment of the present disclosure.

[0046] FIG. 26 is a schematic diagram illustrating PDPC on template with CRS according to an embodiment of the present disclosure.

[0047] FIG. 27 is a schematic diagram illustrating PDPC on template with CRS according to an embodiment of the present disclosure.

[0048] FIG. 28 is a block diagram illustrating a video coder according to an embodiment of the present disclosure.

[0049] FIG. 29 is an example of a computing device according to an embodiment of the present disclosure.

[0050] FIG. 30 is a block diagram of a communication system according to an embodiment of the present disclosure.DETAILED DESCRIPTION OF EMBODIMENTS

[0051] Embodiments of the present disclosure are described in detail with the technical matters, structural features, achieved objects, and effects with reference to the accompanying drawings as follows. Specifically, the terminologies in the embodiments of the present disclosure are merely for describing the purpose of the certain embodiment, but not to limit the disclosure.

[0052] In the context of video compression, a color image or a frame of a color video typically includes three color components: a luma component (Y) and two chroma components (Cb and Cr) . Each component is represented as a data matrix, which is decomposed into blocks associated with specific encoding parameters. A block is usually a square or rectangle, with dimensions that are powers of 2. The coding of an image follows a raster scanning order, proceeding from left to right and then from top to bottom. Within a given block or set of blocks, the luma component is usually encoded before the chroma components.

[0053] Popular video coding standards, such as Versatile Video Coding (VVC) , use a prediction / transform hybrid coding framework. In this framework, prediction involves predicting the current block (i.e., the block to be coded) using either previously coded blocks or coded areas within the same frame (intra prediction) or from a different frame (inter prediction) . When performing intra or inter prediction, the encoder tests multiple prediction modes supported by the coding standard, computes and compares the corresponding prediction blocks, and selects the best mode. The difference between the original current block and the prediction block generated by the selected prediction mode, known as the residual, is then coded. By transmitting only the prediction modes and residuals, the encoder instructs the decoder on how to decode and reconstruct the original image or video, or its approximation.

[0054] To aid in understanding the technical solutions proposed in some embodiments of this application, a brief introduction to a video encoding and decoding system is provided below. As shown in FIG. 1, a video encoding system 110 includes several modules, including a block partitioning unit 1101, transform and quantization unit 1102, intra-frame estimation unit 1103, intra-frame prediction unit 1104, motion compensation unit 1105, motion estimation unit 1106, inverse transformation and inverse quantization unit 1107, filter control  analysis unit 1108, filtering unit 1109, encoding unit 1110, encoded image buffer unit 1111, and a subtractor 1112.

[0055] Original video signals include video frames, and each video frame can be divided into blocks by the block partitioning unit 1101. For each video frame, the subtractor 1112 generates residual pixel information by subtracting the prediction blocks, produced by either the intra-frame prediction unit 1104 or the motion compensation unit 1105, from the original video frame. The residual pixel information, obtained after intra-frame or inter-frame prediction (motion compensation) , is then transformed by the transform and quantization unit 1102. This transformation converts the residual pixel information from the pixel domain to the transform domain, and the resulting transform coefficients are quantized to reduce the bit rate.

[0056] The intra-frame estimation unit 1103 performs intra-frame estimation, and the intra-frame prediction unit 1104 carries out intra-frame prediction on video reconstruction blocks. Motion estimation, performed by the motion estimation unit 1106, generates a motion vector to estimate the movement of the video reconstruction block, which is then used by the motion compensation unit 1105 to perform motion compensation based on the motion vector. After determining an intra-frame prediction mode, the intra-frame prediction unit 1104 provides the selected intra-frame predicted data to the encoding unit 1110, while the motion estimation unit 1106 sends the calculated motion vector data to the encoding unit 1110.

[0057] The inverse transform and inverse quantization unit 1107 reconstructs the video blocks and residual blocks in the pixel domain. The filtering unit 1109, controlled by the filter analysis unit 1108, removes blocking artifacts from the reconstructed residual block. The encoding unit 1110 then adds the reconstructed residual block to the prediction block from the encoded image buffer unit 1111 to generate a fully reconstructed block. The encoding unit 1110 encodes various encoding parameters and quantized transform coefficients into a bitstream, which is then output as the video signal bitstream. The encoded image buffer unit 1111 stores the reconstructed blocks as reference blocks for future intra-frame predictions. As video encoding progresses, new reconstructed blocks are continually generated and stored in the encoded image buffer unit 1111 for future reference.

[0058] As illustrated in FIG. 2, the video decoding system 120 may include multiple modules, including a decoding unit 1201, an inverse transform and inverse quantization unit 1202, an intra-frame prediction unit 1203, a motion compensation unit 1204, a filtering unit 1205, a decoded image buffer unit 1206, and a post filtering unit 1207.

[0059] The input signals of video frames are encoded by the video encoding system 110 to produce an output bitstream. This bitstream is transmitted to the video decoding system 120, where it is received in an encoded (i.e., compressed) format. Within the video decoding system 120, the bitstream is first processed by the decoding unit 1201 to obtain decoded transform coefficients. These transform coefficients are then processed by the inverse transform and inverse quantization unit 1202 to generate a residual block in the pixel domain. The intra-frame prediction unit 1203 generates an intra-frame prediction block for the current video decoding block based on a determined intra-frame prediction mode and data from previously decoded blocks of the current frame or picture. For inter-frame prediction, the motion compensation unit 1204 determines the necessary prediction information and generates an inter-frame prediction block by parsing the motion vector and other relevant syntax  elements. The final decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 1202 with the prediction block generated by either the intra-frame prediction unit 1203 or the motion compensation unit 1204. To enhance video quality, the decoded video blocks are filtered through the filtering unit 1205 to remove blocking artifacts. The decoded block is then stored in the decoded image buffer unit 1206 as a reference for subsequent intra-prediction or motion compensation and for video output, facilitating the reproduction and reconstruction of the original video signals. Optionally, the output video can be further processed by the post-filtering unit 1207 to enhance the viewing experience.

[0060] Some embodiments of the present disclosure relate to coding and decoding of digital images and digital image sequences. Some embodiments of the present disclosure are applicable to both intra and inter coding methods and devices. Some embodiments of the present disclosure may be applied in combination with other intra prediction methods as well as implemented as a hardware or a software module. FIG. 1 and FIG. 2 illustrate that, some embodiments of the present disclosure are mainly used for the intra-frame prediction unit 1104 of the video encoding system 110 and the intra-frame prediction unit 1203 of the video decoding system 120. If a better prediction effect can be obtained in the video encoding system 110 through the intra-frame prediction method provided by the embodiments of the present disclosure, then the quality of video decoding and reconstruction can also be improved. The video decoding system 120 receives the bitstream representing the video frames. The bitstream includes the luma component of the video frame. The intra-frame prediction unit 1203 of the video decoding system 120 can thus obtain the luma component of the reference blocks and the luma component of the current block and calculate the Hamming difference and the weights accordingly. The intra-frame prediction unit 1203 can perform the same intra-frame prediction method as the intra-frame prediction unit 1104.

[0061] Regular Intra Prediction Modes: In H. 266 / VVC and ECM, regular intra prediction modes (IPM) refer to three types of intra prediction modes that directly use neighboring coded samples as reference samples to generate predictors. These modes, which have been supported since H. 264 / AVC, include Planar mode, DC mode, and Angular modes. The process of generating a predictor for the current block using these modes involves utilizing reference samples from neighboring blocks to form the prediction, with each mode applying a different method for constructing the predictor.

[0062] Planar mode: In planar mode, as shown in FIG. 3, the predicted sample at location S= (x, y) of a W×H block is the weighted average of four reconstructed samples: two orthogonal projections from (x, y) to the above reference line A=R (x, -1) and to the left reference line B=R (-1, y) , one reference sample from the above reference line, located at the top-right of the block C=R (W, -1) , and one reference sample from the left reference line, located at the bottom-left of the block D=R (-1, H) . The Planar mode prediction function is as follows: Pred (x, y) = [Ph (x, y) ·H+Pv (x, y) ·W+W·H] >> (log2W+log2H+1) . Ph (x, y) = (W-x-1) ·B+ (x+1) ·C. Pv (x, y) = (H-y-1) ·A+ (y+1) ·D. x∈ [0, W-1] , y∈ [0, H-1] .

[0063] DC mode: In DC mode, each sample in the prediction block is filled with the average value of the reference samples either to the left and / or above the current block:

[0064] If W>H, DC value is the average value of reference samples at the top of the current block:

[0065] If W<H, DC value is the average value of reference samples to the left of the current block:

[0066] If W=H, DC value is the average value of reference samples at the top or to the left of the current block:

[0067] W and H are the width and height of the current block, respectively.

[0068] Angular modes: Angular modes are directional prediction modes that derive samples from reference lines and propagate them at specific angles. In VVC and ECM, there are 65 angular modes, numbered from 2 to 66, as shown in FIG. 4. For Template-based Intra Mode Derivation (TIMD) in ECM, an additional direction is inserted between each pair of neighboring directions, resulting in 129 directions, represented by mode numbers 2 to 130. Mode 34 in IPM or mode 66 in TIMD is known as the "diagonal" mode, where the prediction direction points exactly to the northwest. For mode numbers greater than the diagonal mode, the reference line above the block serves as the main reference line, and the left reference line is secondary. Samples from the secondary reference line are warped as an extension of the main reference line in the prediction direction before generating the predictor. For mode numbers smaller than the diagonal mode, the roles of the above and left reference lines are reversed. To generate predictors, the image is first transposed, and computations are performed using the "mirrored" mode number: 68-x for regular IPM or 132-x for TIMD, where x is the original mode number. The output predictor is then transposed back to its original orientation.

[0069] For modes greater than or equal to the diagonal mode, mode 50 in IPM or mode 98 in TIMD is referred to as the "vertical" mode, where the prediction direction points upwards. Modes with numbers greater than the vertical mode are called "positive" modes, while those with numbers smaller than the vertical mode are called "negative" modes.

[0070] For modes smaller than the diagonal mode, the sign of the mode is the same as its mirrored mode. In summary, the signs of the angular modes are as follows: in IPM, modes 2 to 17 and modes 51 to 66 are positive, while modes 19 to 49 are negative; in TIMD, modes 2 to 33 and modes 99 to 130 are positive, whereas modes 35 to 97 are negative.

[0071] In VVC and ECM, key procedures for computing predicted samples using angular modes include the following steps: generating a vector of reference samples as the main reference line, where the samples can either be reconstructed samples from the chosen reference line (above or left, depending on the angular mode) , padding by copying existing samples on the main reference line, or warping reconstructed samples from the other reference line into virtual positions on the main reference line through interpolation. An example of this process is shown in FIG. 5. The next step involves finding the indices of the reference samples on the main reference line and determining the interpolation filter based on the location of the sample to be predicted and the prediction angle. A fractional number representing the ratio of reference sample location change relative to the distance from the predicted sample to the reference line is provided in a look-up table indexed by the prediction  mode number. This fractional location is then divided into an integer part, indicating the index of the reference sample, and a fractional part, which determines the interpolation filter coefficients. Finally, the predicted value is computed based on one or more reference samples and the corresponding interpolation filter coefficients.

[0072] Multiple reference lines (MRL) for angular modes: In MRL, the reference lines are shifted upwards and leftwards by n lines when the reference line index iRL=n. By denoting the coordinates of the top-left sample of the current block as (0, 0) , the coordinates for the above reference line and the left reference line are yRef=- (iRL+1) and xRef=- (iRL+1) , respectively.

[0073] Template-based Intra Mode Derivation (TIMD) and TIMD fusion: A template-based intra mode derivation (TIMD) method was proposed in JVET-V0098. The use of TIMD to implicitly derive an intra prediction mode for a current block 300 is illustrated in FIG. 6. As shown, the neighboring areas of the current block 300 serve as a template 310, with one area above the block and the other to the left. A cost, referred to as the template matching (TM) cost, is calculated based on the difference (e.g., Sum of Absolute Transformed Differences -SATD) between the prediction and the reconstructed samples of the template. The intra prediction mode with the minimum TM cost is selected and used for the intra prediction of the Coding Unit (CU) . For each candidate intra prediction mode, prediction samples of the template are generated using the reference samples from the reference line 320 of the template, located above and to the left of template 310. The candidate is selected from the most probable mode (MPM) list, which can include 67 intra prediction modes, as in VVC, or an extended set of 131 modes available to TIMD. In other words, the prediction samples from the template serve as the TIMD template predictor, which calculates the prediction results only within the template area. The intra prediction mode represented by this template predictor is then selected and used for the intra prediction of the CU.

[0074] A flag is signaled in a sequence parameter set (SPS) to enable or disable TIMD. When the flag is set to true, a Coding Unit (CU) -level flag is signaled to indicate whether TIMD is used for the current block. If the TIMD flag is true, the remaining syntax elements related to the regular intra prediction mode are skipped. TIMD can be combined with intra sub-partitions (ISP) and multiple reference lines (MRL) . When TIMD is combined with ISP or MRL and the TIMD flag is true, the derived TIMD mode is used as the intra prediction mode for ISP or MRL.

[0075] After selecting the Intra Prediction Mode (IPM) , the coded block is predicted based on reference samples from adjacent decoded blocks. Specifically, the IPM predictor uses the following samples as reference: 1.Selection of Prediction Samples: Once the IPM is chosen, the prediction of the coded block is based on reference samples from neighboring decoded pixels. These reference samples are typically located to the left, above, top-left, or top-right of the current block, depending on the direction of the selected IPM mode. 2. Use of Reference Samples: Different IPM modes use samples from different directions. For example, vertical mode uses reference samples from the top, horizontal mode uses samples from the left, and diagonal modes may use samples from the top-left or top-right. These samples are derived from previously decoded neighboring pixels to predict the current block. Therefore, after selecting the IPM mode, the prediction of the coded block relies on samples from specific directions of adjacent reference pixels, helping to generate accurate prediction results.

[0076] Instead of selecting only the mode with the smallest TM cost, TIMD fusion was proposed to choose the top two intra prediction modes with the lowest TM costs, derived using the TIMD method. A final predictor is then computed based on a weighted average of each prediction.

[0077] Whether to enable TIMD fusion is based on the judgment that the costs of the two selected modes (IPM1 and IPM2) are compared with a threshold. For example, the cost factor of 2 is applied as follows: cost2<2·cost1. cost1 and cost2 are the TM costs of the two selected modes. If this condition is true, the fusion is applied, and the weights of the modes are computed from their TM cost as follows: w1=cost2 /  (cost1+cost2) . w2=1-w1. Otherwise, the only IPM1 is used as the TIMD mode. Details can be obtained from: 1) Y. Wang, L. Zhang, K. Zhang, Z. Deng and N. Zhang, EE2-related: Template-based intra mode derivation using MPMs, document JVET-V0098, Joint Video Experts Team (JVET) , Apr. 2021.2) K. Cao, N. Hu, V. Seregin, M. Karczewicz, Y. Wang, K. Zhang, L. Zhang, EE2-related: Fusion for template-based intra mode derivation, document JVET-W0123, Joint Video Experts Team (JVET) , Jul. 2021.

[0078] TIMD fusion with non-angular predictor: In addition to fusing the top two intra prediction modes, the non-angular intra mode IPM3 is also included in the TIMD fusion process. IPM3 is selected from either the DC mode or Planar mode, based on the one with the lowest TM cost, and is added to the fusion process if it differs from the two selected TIMD intra modes (IPM1 and IPM2) . Whether to enable this TIMD fusion with the non-angular intra mode is determined by a comparison of TM costs. For example, a cost factor of 1.5 is applied as follows: cost3<1.5·cpst1. cost1 and cost3 are the TM costs of IPM1 and IPM3. If this condition is true, the fusion with non-angular intra mode is applied. The weights wi used during the TIMD fusion process are computed from their TM cost:

[0079] In addition to fusion with block-wise weights, location-dependent sample-based blending is also supported. In this approach, the selection of location-dependent weights is based on the ratio of the normalized TM cost of the selected TIMD predictors, calculated from the ABOVE and LEFT template areas. Details can be obtained from: P. Andrivon, M. Blestel, EE2-1.20: TIMD fusion with non-angular predictor, document JVET-AG0092, Joint Video Experts Team (JVET) , Jan. 2024.

[0080] Intra prediction fusion of TIMD mode: Proposal JVET-AB0157 ( “EE2-1.12: Combination of EE2-1.10 and EE2-1.11” ) and JVET-AB0148 ( “EE2-1.11: Intra Prediction Fusion” ) describe an intra prediction method that uses a linear combination of two intra predictors, both derived from the same intra prediction mode but using different reference lines.

[0081] If the angular intra prediction modes include the mode derived from the TIMD method, the proposed approach calculates the intra prediction by applying weighted averages to predictions from multiple reference lines. This is expressed as pfusion=w0pline+w1pline+1, where pline is the prediction from the primary reference line, and pline+1 is the prediction from the line above the primary reference line. The weights used are w0=3 / 4 and w1=1 / 4.

[0082] For the two intra prediction modes derived from TIMD fusion, pline is used for the first mode IPM1 (w0=1, w1=0) , and pline+1 is used for the second mode IPM2 (w0=0, w1=1) . The primary reference line (also referred to as reference line 0) is adjacent to the current block, while the secondary reference line is  above or to the left of the primary reference line, as shown in FIG. 7. Details can be obtained from: H. Wang, V. Seregin, M. Karczewicz, EE2-1.11: Intra prediction fusion, document JVET-AB0148, Joint Video Experts Team (JVET) , Oct. 2022.

[0083] Position-dependent Intra Prediction Combination (PDPC) : In VVC and recent research on future video coding standards, the results of intra prediction modes (such as DC, planar, and several angular modes) are further refined using a position-dependent intra prediction combination (PDPC) method. The core concept of PDPC is to enhance the original intra-predicted block by blending it with values from neighboring reference samples, taken from the opposite boundary along the intra-prediction direction. The final prediction sample Pred (x′, y′) is generated by Pred0 (x′, y′) , which is predicted with an intra prediction mode (DC, planar, angular) and a linear combination of the boundary reference samples according to the following equation: Pred (x′, y′) = (ωL×R (-1, y) +ωT×R (x, -1) -ωTL×R (-1, -1) + (64-ωL-ωT+ωTL) ×Pred0 (x′, y′) +32) >>6. R (-1, y) and R (x, -1) are the reference samples located at the top and left boundaries of the current sample (x′, y′) , respectively, and R (-1, -1) is the reference sample located at the top-left corner of the current block. ωL, ωT and ωTL are the weights for the reference samples R (-1, y) R (x, -1) and R (-1, -1) , respectively. The PDPC weights and scale factors can depend on prediction modes and the block sizes. The PDPC weights for the reference sample are calculated by: ωT=32>> ( (y<<1) >>nScale) . ωL=32>> ( (x<<1) >>nScale) . nScale=min (2, log2 (H) -floor (log2 (3×invAngle-2) ) +8) .

[0084] W and H are the width and height of current block.

[0085] PDPC is applied to the following intra modes without the need for signaling: planar, DC, horizontal, vertical, and angular modes with positive angles (modes with a mode number less than 18 or greater than 50) . In FIG. 4, the angular modes with positive angles are highlighted. In PDPC for DC mode and Planar mode, the coordinates of boundary reference samples R (-1, y) and R (x, -1) are on the same row and the same column as the current sample (x′, y′) , respectively, or in other word, R (-1, y′) and R (x′, -1) are used. ωTL is set to 0 (ωTL=0) . If the current angular mode is horizontal mode, ωT is equal to ωTL (ωT=ωTL) . As to vertical mode, ωL is equal to ωTL (ωL=ωTL) . For other angular modes, ωTL is equal to 0 (ωTL=0) .

[0086] FIG. 8A, FIG. 8B, FIG. 8C, and FIG. 8D show exemplary definitions of reference samples R (-1, y) and R (x, -1) for applying PDPC to various angular modes. The prediction sample Pred (x′, y′) is located at (x′, y′) within a prediction block. R (-1, y) , R (x, -1) , and R (-1, -1) represent the reference samples located at the left, top, and top-left of the prediction block, respectively.

[0087] FIG. 8A shows a top-right diagonal mode PDPC. FIG. 8B shows a bottom-left diagonal mode of the PDPC. FIG. 8C shows an adjacent diagonal top-right mode of the PDPC. FIG. 8D shows an adjacent diagonal bottom-left mode of the PDPC. In an example, such as shown in FIG. 8A, the coordinate x of the reference sample R (x, -1) can given by: x=x′+y′+1, and the coordinate y of the reference sample R (-1, y) can be given by: y=x′+y′+1.

[0088] For other angular modes, such as shown in FIG. 8C and FIG. 8D, the reference samples R (-1, y) and R (x, -1) are located in a fractional sample position. When the reference samples R (-1, y) and R (x, -1) are located in a fractional sample position. the sample value of a nearest integer sample location isused.

[0089] PDPC can be applied to blocks where both the width and height are greater than or equal to 4. However, if the current block is using block-based delta pulse code modulation (BDPCM) mode, PDPC is not applied. Additionally, if the current block is using multiple reference line (MRL) intra prediction mode and the MRL index is greater than 0, PDPC is also not applied.

[0090] Gradient PDPC: In certain scenarios, traditional PDPC may not be applied due to the unavailability of secondary reference samples. Instead, the encoder and decoder can compute PDPC for angular modes using a gradient-based PDPC approach. PDPC is not explicitly checked for every pixel. Rather, the video coder modifies the factor nScale, which is derived from the prediction direction (invAngle) and block size. This automatically determines the PDPC range or the region where PDPC can be applied. As a result, when nScale is less than 0, PDPC is not applied (as illustrated in FIG. 9, for a given prediction direction for the bottom-left sample Pred (x′, y′) within the prediction block) , because the diagonally opposite reference pixel is unavailable. In such cases, gradient-based PDPC can be applied to replace traditional PDPC.

[0091] To perform gradient PDPC, video encoder or video decoder may compute the intensity variation or “gradient” along the prediction direction, as shown by arrow in FIG. 9. For a sample at position (x, y) , video encoder and decoder can fetch a value of horizontally-aligned reference sample R (-1, y) , from the left reference line of current block. To compute the gradient along this prediction direction and offset (a straight line with the same slope as the prediction direction and containing sample R (-1, y) , the encoder and decoder may derive a value for the corresponding pixel in the top reference line, e.g., reference sample R (-1+d, -1) , where d is the horizontal displacement depending on the angular direction. The gradient term can be calculated as R (-1, y) -R (-1+d, -1) . In some examples, the values of d are derived in 1 / 32-pixel accuracy (for integer implementation, d can be a multiple of 32) . The integer (dInt) and fractional (dFrac) of d can be derived using: dInt=d>>5. dFrac=d&31.

[0092] Two tap (linear) filtering can be applied when d is at fractional position, then R (-1+d, -1) is computed as: R (-1+d, -1) = (32-dFrac) ×R (-1+dInt, -1) +dFrac×R (-1+dInt+1, -1) . This 2-tap filtering is performed once per row. Finally, the prediction sample is computed: Pred (x, y) = (ωL (x) × (R (-1, y) -R (-1+d, -1) ) + (64-ωL (x) ) ×Pred0 (, ) +32) >>6 . Pred0 (x, y) is the predicted value before applying gradient PDPC.

[0093] FIG. 10 is a flowchart illustrating an example of rules of PDPC application in an angular prediction. Both PDPC and gradient PDPC are supported in the derivation of the TIMD mode following the same rules.

[0094] Decoder side intra mode derivation (DIMD) : Decoder side intra mode derivation (DIMD) mode is an intra prediction method which derives one or several intra modes from the reconstructed neighboring samples (e.g., luma samples) of current block. DIMD involves performing a gradient analysis on the reconstructed neighboring samples. The neighboring area has an L-shape and is 3 samples wide. When DIMD is used for the  current block, both the encoder and decoder calculate horizontal and vertical gradients within the neighboring area to construct the histogram of gradients (HoG) . These up to five predictors with the highest bin of the histogram are selected and then are combined with the planar mode or block vector-based predictor, with weights derived from the HoG. An intra direction corresponding to each pair of determined horizontal and vertical gradients Gx and Gy is determined as follows:

[0095] An intra prediction mode is obtained from the angle Θ (e.g., one of the 67 intra prediction modes defined in the H. 266 VVC standard) . A magnitude “G” for the pair of gradients and the corresponding intra prediction mode is determined as follows: |G|=|Gx| + |Gy|. When constructing a HoG, a bin of the histogram to be updated is obtained by taking the value of the determined intra prediction mode, and the height of the bin (i.e., a value associated with this bin) is updated using the determined magnitude |G| . The DIMD is signalled in the bitstream for intra coded blocks using a flag. At the decoder, if the DIMD flag is true, the intra prediction mode is derived by the gradient analysis described above. If not, the following intra prediction mode will be parsed from the bitstream.

[0096] Occurrence-based intra coding (OBIC) : The occurrence-based intra coding (OBIC) was proposed in JVET-AH0076. OBIC derives the intra prediction modes of the current block based on the sample-wise occurrence of the intra modes in its spatial neighbourhood. The spatial neighbourhood includes both adjacent and non-adjacent blocks, and the intra prediction modes of these blocks are collected to construct an occurrence histogram. Unlike DIMD, which uses HoGs, the OBIC method constructs the Histogram of Occurrences, which consists of intra modes and their sample-wise occurrences. The occurrence values are calculated based on the number of samples that are coded in a certain intra prediction mode in that neighboring block. For example, if a block is coded with the mode IPMi, the occurrence histogram for that mode will be updated as: O [IPMi] =O [IPMi] +Wk×Hk. Wk and Hk are the width and height of a spatial neighboring block k. The occurrences of the existing modes from the spatial neighbourhood blocks are accumulated into the histogram.

[0097] Up to five angular modes with the highest occurrence, along with the planar mode or block vector-based prediction (similar to DIMD) , are selected from the histogram and used for the final prediction by blending the selected modes. Some blocks use more than one intra mode for prediction. In such cases, all the intra modes of these blocks are selected and included when creating the OBIC histogram. Specifically, DIMD selects up to 5 angular modes, TIMD selects up to 2 modes, SGPM selects 2 modes, and OBIC selects up to 5 angular modes.

[0098] Additionally, the virtual intra prediction modes (VIPMs) of the following blocks are considered only in inter slices when creating the histogram for OBIC mode: MIP block, IntraTMP block, and EIP block. The OBIC mode is used as a sub-mode of DIMD and is applied exclusively to luma blocks. Furthermore, it is disabled for blocks containing fewer than 64 samples. Details can be obtained from: R. G. Youvalari, M. Abdoli, A. Tissier, EE2-2.2: Occurrence-based intra coding (OBIC) , document JVET-AH0076, Joint Video Experts Team (JVET) , Apr. 2024.

[0099] Low Frequency Non-Separable Transform (LFNST) set selection: LFNST is a secondary transform tool which performs matrix multiplication on the transform coefficients of intra-coded blocks after a primary transform in order to further concentrate the residuals to fewer number of coefficients. On the encoder side, LFNST is applied between the forward primary transform and quantization. Correspondingly, on the decoder  side, the inverse LFNST is applied between the inverse primary transform and dequantization. In the LFNST design, the LFNST set and LFNST transpose flag are both determined by the intra prediction mode (predModeIntra) of the current transform block. In ECM-13.0, there are 35 LFNST sets and 3 transform matrices (kernels) per set, and the LFNST set (lfnstTrSetIdx) for a given intra mode (predModeIntra) is derived according to the following formula:

[0100] The LFNST transpose flag determines the scan order of the LFNST output. The LFNST transpose flag is determined by predModeIntra as: if predModeIntra is less than or equal to 34, the LFNST transpose flag is set to 0, or else, the LFNST transpose flag is set to 1.

[0101] For blocks using MIP or IntraTMP prediction, the index of LFNST set is derived as follows. DIMD is used to derive the intra prediction mode of the current block based on the MIP or IntraTMP predicted samples. For MIP, this is done before upsampling. Specifically, a horizontal gradient and a vertical gradient are calculated for each predicted sample to build a HoG. Then the intra prediction mode with the largest histogram amplitude values is used to determine the LFNST transform set and LFNST Transpose flag. Details can be obtained from: M. Coban, R. -L. Liao, K. Naser, J.  L. Zhang, Algorithm description of Enhanced Compression Model 13 (ECM 13) , document JVET-AI2025, Joint Video Experts Team (JVET) , Apr. 2024.

[0102] The decoding process for existing technologies TIMD is illustrated in FIG. 11. In step 2101, the most probable modes (MPM) list is obtained by checking the coded blocks neighboring the current block. In step 2102, predictors are generated based on templates for each IPM in the MPM list. In step 2103, template costs are evaluated for each IPM using the generated predictors. In step 2104, 1 to 3 IPMs with the lowest template costs are selected. Finally, in step 2105, the predictor for the current block is generated using the selected IPMs.

[0103] In Step 2102, the procedure for generating predictors for each IPM on the templates can be further broken down into three steps, as shown in FIG. 12. In step 2201, templates and corresponding reference samples are obtained. This step is the same for all IPMs in the same MPM list, and the result from one execution should serve all IPMs. In step 2202, the predictor is generated on the templates for the IPM under consideration. In step 2302, PDPC is applied to the predictor generated in step 2202, if applicable.

[0104] The decoding process for the virtual intra prediction mode (VIPM) in TIMD and SGPM is as follows: VIPM is a valid IPM index used when a block is checked for its IPM index but is not coded with a regular IPM. VIPM serves two main purposes: (1) it acts as an index for selecting the LFNST transform matrix set used for coding the residuals of the corresponding block, and (2) it serves as the IPM when the coding of subsequent blocks requires the prediction mode of the current block. For example, in OBIC, when the IPM of a location coded by SGPM is queried, VIPM can be used as if that location were coded with that IPM. In SGPM, VIPM is determined based on the partition mode, as shown in FIG. 13, while in TIMD with fusion, VIPM is the first mode in the TIMD mode list.

[0105] There may be some issues in current technologies:

[0106] Issue 1: Distinct reference used for prediction in template and predicted block.

[0107] In existing template-based prediction methods, the reference samples used for prediction in the template area differ from those used for prediction in the current block. As a result, prediction accuracy may vary significantly depending on the discrepancy between the image content in the template area and the current block. This discrepancy becomes more pronounced as the template size (measured by the number of lines or columns) increases, which is typically done to improve template matching accuracy. Therefore, minimizing this discrepancy should enhance the accuracy of template-based prediction methods.

[0108] Issue 2: Lack of diversity in template predictions.

[0109] Despite various methods being proposed to enhance template prediction results, such as fusion mechanisms or additional cost metrics for TM cost comparison, these predictions often remain highly similar. Increasing the diversity of template predictions could improve the accuracy of template-based predictions, as the current template may not always accurately represent the content of the current block.

[0110] Some ideas behind some embodiments of the present disclosure are to introduce template-based mode derivation and predictor generation using reference samples that are shared between both the template area and the coded block. Some embodiments of the present disclosure introduce a template-based mode derivation and predictor generation scheme in which the predictors are generated using common reference areas for both the current block and the templates. The core concept of template-based intra mode derivation (TIMD) is to test a list of intra prediction modes on the templates against the actual reconstructed samples and select the best modes for predicting the current block based on their performance on the template. The common reference samples (CRS) proposed in these embodiments provide a better understanding of how the reference lines would perform in predicting the current block, compared to prior art solutions. In the context of image and video coding, two methods are proposed for incorporating template-based mode derivation with CRS: (1) use CRS-derived mode (s) to generate predictors for the current block, and (2) add CRS-derived mode (s) to the candidate mode list for other existing prediction modes. Additionally, this disclosure proposes adapting a HoG-based method for VIPM derivation to select the LFNST transform matrix set. By adopting the proposed CRS for mode derivation, the likelihood of selecting the most suitable prediction mode is significantly increased, reducing bit rate and improving coding performance in existing image and video coding standards.

[0111] Technical solutions:

[0112] Some embodiments of the present disclosure propose introducing template-based mode derivation and predictor generation using common reference samples (CRS) . The key inventive aspect is to utilize as many CRS as possible, which are used both for prediction in the current block and for generating template predictors during the mode derivation process. To make this new arrangement of reference samples viable, the relative positions of the reference samples, templates, and current block need to be adjusted compared to existing technologies, and the predictor generation procedures must be modified accordingly. Furthermore, CRS-derived modes can be incorporated into existing image and video coding standards in several ways: CRS-derived modes can be directly used as prediction modes for the current block or added to the mode candidate lists of other prediction modes. These options are compatible with each other and can be activated simultaneously. Once the prediction block is generated, the selection of the LFNST transform matrix can be further refined using the virtual intra prediction mode (VIPM) , which is derived from the histogram of gradient (HoG) method, as used  in DIMD. This derivation process can be applied to blocks coded with CRS-derived modes where fusion is activated, as well as TIMD with fusion activated and / or SGPM. The proposed solutions include: 1. Template-based prediction with common reference samples (CRS) : a) Definition of common reference samples and corresponding templates. b) Generation of predictors for the templates using CRS. 2. Usage of CRS-derived modes: a) Use CRS-derived modes to generate the predictor for the current block. b) Add CRS-derived modes to the mode candidate lists of other modes, including OBIC, SGPM, combined inter-intra prediction (CIIP) , etc. 3. Adjustment of HoG-based VIPM derivation for TIMD fusion blocks with and without CRS, and for SGPM blocks.

[0113] "Adjustment" can encompass a variety of synonyms, including but not limited to the following: Modification, which refers to partial changes made to a system, process, or design to meet new requirements or improve performance; Alteration, indicating changes to the original structure or arrangement without fundamental transformation; Tuning, primarily used for fine-tuning precision or performance to achieve optimal results; Adaptation, referring to adjustments made to better suit new circumstances or conditions; Calibration, often used in technical contexts, meaning adjustments made according to a standard to ensure accuracy; Correction, which refers to changes made to correct errors or achieve greater accuracy; Refinement, indicating gradual improvements through small adjustments; and Reconfiguration, which refers to rearranging or reorganizing an existing system to achieve new outcomes. This disclosure is not limited to the use of these synonyms, and specific terminology can be flexibly chosen depending on the needs of the application.

[0114] Solution: Template-based prediction with common reference samples (CRS) :

[0115] FIG. 14A is a flowchart illustrating a prediction method applied to a video coder according to an embodiment of the present disclosure. The prediction method 1400A is configured to implement some embodiments of the disclosure. Some embodiments of the disclosure may be implemented into the prediction method 1400A using any suitably configured hardware and / or software. In some embodiments, the prediction method 1400A includes: an operation 1401A, determining at least one reference sample and at least one template, wherein the at least one reference sample and the at least one template are defined by a reference line of a current block, and an operation 1402A, generating at least one predictor on the at least one template based on the at least one reference sample. In some embodiments, the at least one reference sample is the same as at least one sample used for prediction of a current block. In some embodiments, the at least one predictor is added to a most probable modes (MPM) list, and the at least one predictor is used as a candidate. In some embodiments, the prediction method further includes applying a position-dependent intra prediction combination (PDPC) on the least one predictor. This can provide at least one improvement for video coding and / or can be used in many applications.

[0116] This solution outlines the mechanism of template-based prediction using common reference samples (CRS) . As described in prior art, generating predictors on the templates is a crucial step in template-based mode derivation. In existing technologies, the templates are typically coded samples adjacent to the current block, and the reference samples for generating predictors on the templates are samples from the neighborhood of the templates, which are often farther from the coded block than the templates themselves. In this solution, the dependency chain from the current block to the templates to the reference samples for the template is modified. The reference samples for generating predictors on the templates are first defined based on the reference samples  used for generating predictors on the current block. The templates are then defined in the neighborhood of the current block, excluding samples already used as reference samples.

[0117] As shown in FIG. 14B, the key procedures for template-based prediction with CRS are as follows: In step 3101, templates and reference samples for generating predictors on the templates are determined (details can be found in Embodiment 1. In step 3102, predictors are generated on the templates using the reference samples mentioned earlier for conventional intra prediction modes (details are available in Embodiment 2) . In step 3103, position-dependent intra prediction combination (PDPC) can also be adapted for predictor generation on the templates with CRS (further explained in Embodiment 3. The results from these predictor generation steps can be applied in the mode derivation process discussed in prior art, with the usage of the mode derivation results explained in the next solution.

[0118] Solution 2: Usage of CRS-derived modes:

[0119] FIG. 15A is a flowchart illustrating a prediction method applied to a video coder according to an embodiment of the present disclosure. The prediction method 1500A is configured to implement some embodiments of the disclosure. Some embodiments of the disclosure may be implemented into the prediction method 1500A using any suitably configured hardware and / or software. In some embodiments, the prediction method 1500A includes: an operation 1501A, using at least one common reference sample (CRS) -derived mode and / or at least one non-CRS method to generate at least one predictor for a current block, an operation 1502A, generating at least one prediction block based on at least one template from a most probable mode (MPM) list, and / or an operation 1503A, adding the at least one CRS-derived mode to at least one candidate list of a prediction mode. In some embodiments, adding the at least one CRS-derived mode to the at least one candidate list of the prediction mode includes deriving and executing the at least one candidate list, wherein at least one IPM in the at least one candidate list comprises at least one intra prediction mode, at least one intra block copy (IBC) mode, at least one decoder side intra mode derivation (DIMD) mode, at least one template-based intra mode derivation (TIMD) -derived mode, and / or at least one CRS-derived mode. In some embodiments, the at least one IPM from blocks coded in at least one spatial geometry partition mode (SGPM) , the at least one TIMD-derived mode without CRS, and / or the at least one TIMD-derived mode with CRS comprise a virtual intra prediction mode (VIPM) derived using a histogram of gradients (HoG) -based method. In some embodiments, the at least one candidate list comprises at least one spatial geometry partition mode (SGPM) candidate list. This can provide at least one improvement for video coding and / or can be used in many applications.

[0120] The results of mode derivation procedures using predictors generated from CRS can be applied in various ways in video coding. This solution outlines several use cases for CRS-derived modes, which can either be directly used by the decoder as the prediction mode for the current block or added to the candidate lists of other prediction modes. The key advantage of this approach is that it efficiently signals the desired coding mode without requiring multiple bits to indicate the selected mode from a growing list of potential options. CRS-derived modes can be used to generate predictors for the current block or added to the mode candidate lists of other prediction modes, such as OBIC, SGPM, and combined inter-intra prediction (CIIP) .

[0121] Solution 2.1: Use CRS-derived modes to generate predictor for the current block: The flowchart for using CRS-derived modes to generate predictors for the current block is shown in FIG. 15B. In this solution, the  design of reference samples and templates with CRS serves as an option or alternative to the existing TIMD method. Key procedures include determining whether mode derivation in TIMD should use prediction results with CRS or existing (non-CRS) methods, based on either signals in the bitstream (as explained in Embodiment 5) or decoder-side derivation (detailed in Embodiment 6) . Predictors are then generated on the templates for each element in the MPM list, following the procedures described in Solution #1: Template-based prediction with common reference samples (CRS) . The best prediction modes for the current block are derived (as outlined in Embodiment 4) , and finally, the prediction block for the current block is generated.

[0122] The decoding process for adding CRS-derived modes to the OBIC occurrence histogram is shown in FIG. 16. Key procedures include, in step 3401, collecting and counting IPMs from neighboring coded locations. The collected intra prediction modes (IPMs) consist of regular IPMs, IPMs from DIMD, TIMD, SGPM, OBIC, virtual IPMs derived in the coded block, and IPMs from CRS derivation, as detailed in Embodiment 7. IPMs from blocks coded in SGPM, TIMD, and TIMD with CRS may include VIPMs derived using a HoG-based method, as explained in Embodiment 9. Steps 3402 to 3404 cover the remaining OBIC procedures.

[0123] Solution 2.2: Add CRS-derived modes to SGPM mode candidate list: The decoding process for adding CRS-derived modes to the SGPM mode candidate list is shown in FIG. 17. The key procedures include, in step 3501, deriving the IPM candidate list, where the IPMs can consist of regular intra prediction modes, IBC modes, DIMD modes, TIMD-derived modes, and CRS-derived modes, as detailed in Embodiment 8. Additionally, IPMs from blocks coded in SGPM, TIMD, and TIMD with CRS may include VIPMs derived using a HoG-based method, as explained in Embodiment 9. Finally, in steps 3502-3503, the remaining SGPM procedures are executed.

[0124] Solution 3: Adjustment of HoG-based VIPM derivation for TIMD fusion blocks with and without CRS, and SGPM blocks:

[0125] FIG. 18A is a flowchart illustrating a prediction method applied to a video coder according to an embodiment of the present disclosure. The prediction method 1800A is configured to implement some embodiments of the disclosure. Some embodiments of the disclosure may be implemented into the prediction method 1800A using any suitably configured hardware and / or software. In some embodiments, the prediction method 1800A includes: an operation 1801A, decoding at least one block coded in a template-based intra mode derivation (TIMD) fusion, with or without at least one common reference sample (CRS) , and / or a spatial geometry partition mode (SGPM) to obtain a prediction block, and an operation 1802A, deriving a virtual intra prediction mode (VIPM) from the prediction block using an adjustment histogram of gradients (HoG) -based method. This can provide at least one improvement for video coding and / or can be used in many applications.

[0126] For blocks coded in TIMD fusion (with or without CRS) and in SGPM, VIPM can be derived using the HoG-based method, as in DIMD. FIG. 18B illustrates that, in some embodiments, the key aspects of the decoding procedure include obtaining the prediction block through the decoding steps of TIMD fusion or SGPM from prior art, or through TIMD with CRS and fusion from previous solutions. A histogram of gradients is then built for the prediction block, and VIPM is derived from it. Further details can be found in Embodiment 9.

[0127] Embodiment 1: Obtaining reference samples and templates for template prediction with CRS:

[0128] In some examples, determining the at least one reference sample and the at least one template comprises reusing the at least one reference sample to generate the at least one predictor on the current block. In some examples, determining the at least one reference sample and the at least one template comprises shifting the at least one template to at least one nearby location of the at least one template, such that the at least one reference sample and the at least one template do not overlap.

[0129] In details, in some examples, the reference samples used for generating predictors on the templates are characterized by two key aspects: reusing the same reference samples that are used for generating predictors on the current block and shifting the templates to nearby locations to prevent any overlap between the reference samples and the templates.

[0130] In some embodiments, the at least one reference sample and the at least one template are defined by the reference line of the current block comprises the at least one reference sample comprises samples in a first reference line area and a second reference line area, and the at least one template comprising an above template area and a left template area. In some embodiments, the samples in the first reference line area are same as samples used for prediction of the current block, and the samples in the second reference line area are extended from the reference line of the current block. The description of FIG. 19 and FIG. 20, combined with the content you provided, outlines the usage of reference lines in prediction for coding blocks. In some embodiments, the reference samples and templates are defined by reference lines, including a first and second reference line area. As seen in FIG. 19, the reference lines for the current block are extended to avoid overlap with adjacent templates, while FIG. 20 illustrates the further extension of these lines in planar and angular prediction modes. These extended reference samples can be filled using various methods like reconstructed samples, nearest available references, or extrapolated samples.

[0131] In details, as illustrated in FIG. 19, when the reference line index is 0, the row directly above the block and the column to the left of the block are used as reference lines 402 for generating predictors on the current block 400. With CRS, these same samples are also utilized as part of the reference lines for generating predictors on the templates. To avoid overlap, the above and left templates 401, typically adjacent to the current block, are shifted upwards and leftwards. To generate predictors on the templates, the reference lines are extended (403) to cover the areas adjacent to the templates: (1) the left reference line is extended upwards to include the area to the left of the above template, and (2) the above reference line is extended leftwards to include the pixels at the top of the left template.

[0132] In details, FIG. 20 illustrated that, in some examples, in planar mode and some angular prediction modes, the reference lines need to be further extended to ensure the coder has the necessary data when the prediction mode requires samples from these locations, as shown in FIG. 20. The extended reference samples can be filled using several methods: (1) Reconstructed samples, where available, are used to fill in the extended reference samples; (2) Nearest available reference samples are used for padding; (3) DC values, which are the average of the reference line or the image's pixel values, are used; (4) Extrapolated samples, generated using the closest available reference samples and extrapolation filters; and (5) Samples from the other reference line, where for angular modes, the reference sample is determined by the intercept between the other reference line and a straight line extending in the opposite direction of the prediction.

[0133] In some embodiments, when an index of the reference line is not equal to 0 and the at least one template is not overlapped with the reference line, the above template area is above the reference line and the left template area is to a left of the reference line. In some embodiments, when an index of the reference line is not equal to 0 and the at least one template is overlapped with the reference line, the above template area has a first above sub-area and a second above sub-area, the left template area has a first left sub-area and a second left sub-area, the first above sub-area is above the reference line and the second above sub-area is between the reference line and the current block, and the first left sub-area is to a left of the reference line and the second left sub-area is between the reference line and the current block. Combining the content of FIG. 21 and FIG. 22, FIG. 21 illustrates that when the index of the reference line is not equal to 0, the at least one template do not overlap with the reference line. When the index of the reference line is n, the at least one reference line shifts n rows upwards or n columns leftwards, and the at least one template moves accordingly to avoid overlap. As shown in FIG. 22, the template areas are divided into two sub-areas located above and to the left of the reference line, allowing the at least one template to stay close to the current block while avoiding interference with the at least one reference sample, ensuring accurate prediction.

[0134] As another example, when reference line index is iRL=n, the above reference line is shifted n lines upwards compared to when reference line index is 0, and the left reference line is also shifted n lines leftwards. The above and left templates are further shifted to avoid overlap with the reference lines. The positions of reference lines and templates when iRL=1 are shown in FIG. 21.

[0135] As shown in FIG. 22, another example defines the templates as the areas above and to the left of the current block, excluding the reference lines. In this example, to position the templates as close as possible to the current block without overlapping the reference samples, the templates are split by the reference lines. In details, as shown in FIG. 22, another example defines the templates as the areas located directly above and to the left of the current block, excluding the reference lines. In this case, to bring the templates as close as possible to the current block while avoiding any overlap with the reference samples, the templates are split by the reference lines. For instance, if a reference line is located directly adjacent to the current block, the template area that would normally overlap with this reference line is divided into two parts-one section placed above the reference line and another section to the left. This method ensures that the templates remain close to the current block while maintaining a clear separation from the reference samples, allowing the coder to generate accurate predictions without interference.

[0136] In some embodiments, a size of the at least one template is determined by a size of the current block. In some embodiments, when the size of the current block is greater than a threshold, the size of the at least one template is 4x4. In some embodiments, when the size of the current block is smaller or equal to a threshold, the size of the at least one template is 2x2. In some embodiments, the threshold is equal to 8. In this description, the size of the template is determined based on the size of the current block. As explained, when the minimum or maximum block size of the current block is less than or equal to 8, min (W, H) ≤8 or max (W, H) ≤8, the template size is 2x2. When the minimum or maximum block size is greater than 8, min (W, H) >8 or max (W, H) >8, the template size is 4x4. Tables 1 and 2 further clarify how the coding information affects the size, with different side lengths (W and H) being considered to adjust the template's dimensions accordingly.

[0137] Regarding template size and adjustment of template positions, If the left template is available, set its dimensions to at most WT columns by H rows. If the above template is available, set its dimensions to at most W columns by HT rows, where W and H are the width and height of the current block, respectively. The values of WT and HT may be signalled in the bitstream or depend on coding information.

[0138] For example, the coding information may be the minimum side length of the current block or neighboring blocks as illustrated in Table 1.

[0139] Table 1: Coding information as the minimum side length of the current block or neighboring blocks.

[0140] For example, the coding information may be the maximum side length of the current block or neighboring blocks as illustrated in Table 2.

[0141] Table 2: Coding information as the maximum side length of the current block or neighboring blocks.

[0142] For example, the coding information may be the corresponding side length of the current block or neighboring blocks.

[0143] For example, the template sizes are set by existing methods or respective image and video coding standards wherever CRS is applied.

[0144] In some embodiments, when an index of the reference line is greater than a predetermined threshold, an area of the at least one template is between the reference line and the current block.

[0145] Adjusting template positions when reference line index is sufficiently large: If reference line index iRL is large enough such that templates can fit into the space between reference lines and current block, the templates can be defined as in TIMD. In some examples, iRL≥WT, iRL≥HT.

[0146] In some embodiments, when the index of the reference line exceeds a predetermined threshold, the area of at least one template is positioned between the reference line and the current block. As described, when the reference line index iRL is sufficiently large, such that the templates can fit into the space between the  reference lines and the current block, the templates can be defined using the TIMD method. For example, when iRL≥WT, iRL≥HT, the templates are adjusted to fit appropriately in this space, ensuring accurate configuration.

[0147] Embodiment 2: Generate predictors on template with CRS:

[0148] In some embodiments, the IPM comprises a planar mode, a DC mode, or an angular mode based on the at least one CRS. In some embodiments, generating the at least one predictor on the at least one template from the at least one reference sample with the planar mode using the at least one CRS comprises generating at least one predicted sample based on four points surrounding each of the at least one template, wherein the at least one predicted sample comprises two orthogonal projection samples and two additional reference samples, and the two additional reference samples are mirrored relative to the at least one template. In some embodiments, generating the at least one predictor on the at least one template from the at least one reference sample with the angular mode using the at least one CRS comprises adjusting the angular mode using the at least one CRS to determine at least one prediction location of the at least one predictor to at least one nearby location of the at least one reference sample. In some embodiments, adjusting the angular mode using the at least one CRS comprises reusing a set of directions supported by corresponding video codecs and / or extending a reference line relative to the at least one template.

[0149] This embodiment introduces the generation of template predictors corresponding to regular intra prediction modes (IPMs) , which include Planar, DC, and angular modes. The following subsections explain the predictor generation method using CRS (Contextual Reference Samples) .

[0150] In some embodiments, the at least one reference sample is used for the at least one predictor on the current block. In some embodiments, generating the at least one predictor on the at least one template based on the at least one reference sample comprises: generating a predicted sample based on four points surrounding the at least one template, wherein the predicted sample comprises two orthogonal projection samples and two additional reference samples, and the two additional reference samples are mirrored relative to the at least one template. In some embodiments, at least one reference sample is used to generate at least one predictor on the current block. This process involves generating a predicted sample based on four surrounding points, similar to regular IPM, but adapted to the template's range. For example, as shown in FIG. 23, two orthogonal projection samples (A and B) are used along with two additional reference samples (C and D) mirrored relative to the template. In some cases, virtual values are extrapolated for the mirrored samples to enhance prediction accuracy, ensuring better template alignment.

[0151] Example 1: In this example, for each location in the templates, the predicted value from CRS planar prediction is calculated from the same four reconstructed samples as in regular IPM, except that the range of sample coordinates (x, y) are changed to the range of the templates.

[0152] Example 2: In this example, as shown in FIG. 23, CRS planar prediction generates predicted samples based on four surrounding points for each template: two orthogonal projections (samples A and B) , as in regular IPM, and two additional reference samples mirrored vertically for the above template and horizontally for the left template. For the above template, the "above" reference line is positioned at the bottom of the template, with the sample at the bottom-right serving as sample C, identical to sample C in regular IPM, and the sample at the  top-left mirrored relative to the above reference line, acting as sample D. For the left template, the "left" reference line is on the right side of the template, where the sample at the top-left is mirrored relative to the left reference line as sample C, and the sample at the bottom-right remains the same as sample D in regular IPM.

[0153] Example 3: In this example, the two orthogonal projections (samples A and B) are the same as they are in regular IPM, while either of the mirrored reference samples C and D uses virtual values calculated by extrapolation. For above template, ‘above’ reference line is at the bottom of the template. The sample to the bottom-right of the above template is used as sample C, which is effectively the same as sample C in regular IPM. Sample D is replaced by a virtual reference sample D’, which is extrapolated from two reconstructed samples in the left reference line: sample R (-1, H) as in regular IPM and the intersect of reference lines R (-1, -1) . The weights are determined by their relative distances to the virtual position (-1, -1-HT) .

[0154] For left template, ‘left’ reference line is at the right of the template. The sample to the bottom-right of the left template is used as sample D, which is effectively the same as sample D in regular IPM. Sample C is replaced by a virtual reference sample C’, which is extrapolated from two reconstructed samples in the left reference line: sample R (W, -1) as in regular IPM and the intersect of reference lines R (-1, -1) . The weights are determined by their relative distances to the virtual position (-WT-1, -1) .

[0155] CRS DC prediction: CRS DC prediction fills the templates with the same value that would be derived in regular DC mode. In details, in some examples, CRS DC prediction fills the templates by using a value derived similarly to regular DC mode, where the predicted value is typically the average of the reference samples surrounding the template. For example, in regular DC mode, if the reference samples from the top and left sides of the block are used, their average is computed and applied to fill the entire block. In CRS DC prediction, the same principle applies: the reference samples are averaged, and the resulting value is used to fill the template. The key difference is that CRS may include additional or mirrored reference samples depending on the specific template configuration, but the prediction value itself is calculated in the same way as regular DC mode. For instance, if the reference samples for a particular template are 150 and 160, their average (155) would be used to fill the entire template.

[0156] In some embodiments, a prediction location of the at least one predictor is defined based on an adjustment angular mode. In some embodiments, in the adjustment angular mode, a set of directions supported by the video coder are used for the at least one predictor; and / or the reference line is extended relative to the at least one template.

[0157] CRS angular prediction: CRS angular prediction is an adaptation of regular angular modes to handle cases where the locations to be predicted are below or to the right of the reference samples. Details on the generation of predictors in regular angular modes. Key aspects of this adaptation include reusing the set of directions supported by corresponding video codecs, allowing interpolation and propagation of reference samples either in the same or opposite direction as in existing methods. This reuse involves discretizing prediction angles, computing reference sample indices, selecting the appropriate interpolation filter, and calculating predicted values. Additionally, the adaptation extends the main reference line by employing padding  and / or warping methods, as described in prior art, and by utilizing reconstructed samples located on the extended part of the reference line.

[0158] Filling main reference line: Without limiting the scope of the present disclosure, the following use cases pertain exclusively to mode numbers greater than the diagonal mode. This is provided as an illustrative example, and the present disclosure is not limited thereto.

[0159] Negative modes:

[0160] In some embodiments, applying the PDPC on the at least one predictor comprises: determining applicability to specific angles, wherein applying the PDPC on the at least one predictor is applicable to a factor, the factor refers that a sample to be predicted is located between intersects of a prediction line and reference lines, and the prediction line is related to the current block, passes through the sample to be predicted, and extends along a prediction direction.

[0161] As shown in FIG. 24, the reference samples above the current block and a portion of the samples to their right are directly used in main reference line. Ref (x) = R (x, -1) , -1≤x≤LR-1.

[0162] LR is the length of the reference samples in the positive direction as in TIMD.

[0163] To generate predictors for left template, the main reference line can be extended to the left. This can be done by either of the followings:

[0164] Warping a portion of left reference line as in regular angular mode prediction. Ref (x) = R (-1, min ( (x×invAngle (mode) +256) >>9, H) ) , -H-WT-1≤x≤-2.

[0165] Using the available reconstructed samples, if applicable. Ref (x) =R (x, -1) , -H-WT-1≤x≤-2.

[0166] Using the available reconstructed samples up to the locations above the left template and warping a portion of left reference line as in regular angular mode prediction for the leftmost part.

[0167] invAngle is the inverse angle parameter which is derived from a look-up table with respect to the prediction mode number. The intraPredAngle look-up table and method for calculating corresponding invAngle value is described in section 8.4.5.2.13 of April 2022 version of H. 266 / VVC standard.

[0168] To generate predictors for above template, the main reference line should also be extended to the right. This can be done by either of the followings:

[0169] Copying the nearest reference sample on the above reference line. Ref (LR-1+t) =R (LR-1, -1) , 1≤t≤maxIndex.

[0170] Using the available reconstructed samples, if applicable. Ref (LR-1+t) =R (LR-1+t, -1) , 1≤t≤maxIndex.

[0171] maxIndex is the length of the extended samples required according to the prediction direction and derived as in existing methods.

[0172] Using extrapolated values from the nearest reference sample on the above reference line and the intersect of the above and the left reference lines.

[0173] Positive modes:

[0174] As shown in FIG. 25, the reference samples above the left template and the current block as well as a portion of the samples to their right are directly used in main reference line. Ref (x) = R (x, -1) , -WT-1≤x≤LR-1.

[0175] LR is the number of reference samples in the above reference line for predicting the current block.

[0176] To generate predictors for above template, the main reference line can be extended to the left. This can be done by either of the followings:

[0177] Copying the nearest reference sample on the above reference line. Ref (x) = R (-WT-1, -1) , -WT-1-sizeSide≤x≤-WT-2.

[0178] Using the available reconstructed samples, if applicable. Ref (x) =R (x, -1) , -WT-1-sizeSide≤x≤-WT-2.

[0179] To generate predictors for left template, the main reference line should also be extended to the right. This can be done by either of the followings:

[0180] Copying the nearest reference sample on the above reference line. Ref (LR-1+t) =R (LR-1, -1) , 1≤t≤maxIndex.

[0181] Using the available reconstructed samples, if applicable. Ref (LR-1+t) =R (LR-1+t, -1) , 1≤t≤maxIndex.

[0182] Using extrapolated values from the nearest reference sample on the above reference line and the intersect of the above and the left reference lines.

[0183] For mode numbers smaller than diagonal mode, the procedures for obtaining the main reference line are similar to mode numbers greater than diagonal mode with horizontal and vertical coordinates being swapped.

[0184] Generating predictors: The predictors for any sample in the above or left template can be generated by reusing the TIMD angular prediction process. The key steps in this computation method include: 1. Identifying a sample location on the main reference line, based on the position of the sample to be predicted, which can be broken down into an integer part and a fractional part. 2. Calculating the predicted value using the reference samples on the main reference line determined by the integer part, and applying interpolation filter coefficients based on the fractional part.

[0185] The following example demonstrates an adaptation of predictor generation from VVC / ECM to CRS method. Regarding obtaining sample location, denote the location of the sample to be predicted as (x, y) , the integer part iIdx and fractional part iFrac of the sample location on the main reference line is:

[0186] For Luma component: iIdx= (Δy×intraPredAngle) >>6. iFrac= (Δy×intraPredAngle) &63.

[0187] For Chroma component: iIdx= (Δy×intraPredAngle) >>5. iFrac= (Δy×intraPredAngle) &31.

[0188] Δy=y-yRef=y+1 is the difference between the sample coordinate and the main reference line coordinate and intraPredAngle is a location shift multiplier in a look-up table with respect to prediction mode number.

[0189] In regular IPM or in TIMD, Δy is always positive since the sample to be predicted is always located within the block.

[0190] Regarding calculating predicted value, in CRS angular prediction, the predicted value for luma component is obtained by applying a filter on the samples at the environs of the sample location determined above.

[0191] fT (p, j) is the coefficient of the n-tap interpolation filter with respect to the fractional part of the sample location iFrac and filter tap number j.

[0192] For chroma components, the predicted value is a weighted average of two reference samples. Pred (x, y) = ( (32-iFrac) ×Ref (x+iIdx) +iFrac×Ref (x+iIdx+1) +16) >>5.

[0193] Specifically, if iFrac=0, filtering or weighted averaging is not required since the sample location is an integer. Pred (x, y) =Ref (x+iIdx) .

[0194] Embodiment 3: PDPC on template with CRS:

[0195] In some embodiments, applying the PDPC on the least one predictor based on the at least one CRS comprises determining applicability to specific angles, wherein applying the PDPC on the least one predictor based on the at least one CRS is applicable to at least one factor, wherein the at least one factor refers that the at least one reference sample to be predicted is located between intersects of a prediction line and reference lines, and the prediction line refers to a straight line that goes through the at least one reference sample to be predicted and is along a prediction direction. In some embodiments, applying the PDPC on the least one predictor based on the at least one CRS comprises determining at least one PDPC weight for the at least one reference sample based on a relative distance of at least one prediction sample in the at least one template and the at least one reference sample.

[0196] In this embodiment, PDPC is applied when generating predictors with CRS. The differences from the regular PDPC are mainly in two aspects:

[0197] The applicability to specific angles: PDPC requires that reference samples are available when the prediction direction is extended to both sides and the sample to be predicted is located between the two reference samples along the prediction direction. Therefore, while Regular PDPC is applicable to positive modes, PDPC for CRS-derived template predictors is applicable to negative modes. FIG. 26 illustrates the process of finding the reference sample on the second reference line. For example, for the predictors in the above template, the  reference sample R (-1, y) is available at the intersect of the left reference line and the prediction line extended in the opposite direction of current angular prediction. For example, in the left template, the reference sample R (-1, y) is available at the intersect of the left reference line and the prediction line extended in the opposite direction of current angular prediction.

[0198] PDPC weights: The weights for the reference samples are determined by the relative distance of the prediction samples in the template and the reference samples. For example, the PDPC weights for the reference sample are calculated by: ωT=32>> ( (Δy<<1) >>nScale) . ωL=32>> ( (Δx<<1) >>nScale) .

[0199] Δx=|x+1|-1 is the number of pixels between the sample to be predicted and the left reference line, and Δy=|y+1|-1 is the number of pixels between the sample to be predicted and the above reference line, as shown in FIG. 27.

[0200] Embodiment 4: Mode derivation in TIMD with CRS:

[0201] In some examples, using the at least one CRS-derived mode to generate the at least one predictor for the current block comprises deriving using the at least one CRS-derived mode to generate the at least one predictor for each IPM in the MPM list with CRS in a template-based intra mode derivation (TIMD) . This example uses only CRS-derived mode example, but the present disclosure is not limited thereto. In other examples, there are other modes as shown below.

[0202] In some examples, using the at least one CRS-derived mode and / or the at least one non-CRS method to generate the at least one predictor for the current block comprises deriving using the at least one CRS-derived mode to generate the at least one predictor for each IPM in the MPM list with CRS in a template-based intra mode derivation (TIMD) . In some examples, using the at least one CRS-derived mode and / or the at least one non-CRS method to generate the at least one predictor for the current block comprises deriving using a combined metric to generate the at least one predictor for each IPM in the MPM list with CRS and without CRS in TIMD. In some examples, deriving using the combined metric comprises using the at least one CRS-derived mode to calculate a first cost for the same IPM in the same set of MPM lists; using the at least one non-CRS method to calculate a second cost for the same IPM in the same set of MPM lists; generating the combined metric based on the first cost and the second cost and sorting IPMs in the MPM list based on the combined metric. In some examples, using the at least one CRS-derived mode and / or the at least one non-CRS method to generate the at least one predictor for the current block comprises deriving using a mixed list to generate the at least one predictor for each IPM in the MPM list with CRS and without CRS in TIMD. In some examples, deriving using the mixed list comprises using the at least one CRS-derived mode to calculate a first cost for the same IPM in the same set of MPM lists; using the at least one non-CRS method to calculate a second cost for the same IPM in the same set of MPM lists; generating a first list based on the first cost, generating a second list based on the second cost, and generating the mixed list based on the first list and the second list.

[0203] In the embodiments, with predictors on templates generated using CRS, the mode derivation process in TIMD can be adjusted to better accommodate different prediction scenarios. In TIMD (Template-based Intra Mode Derivation) , the regular prediction modes such as Planar, DC, and angular are used to generate prediction  samples. When CRS (Contextual Reference Samples) is applied, these predictors can be enhanced by incorporating additional or mirrored reference samples, allowing the mode derivation process to adapt to more complex prediction cases. For example, in regular TIMD mode derivation, angular prediction is based on the directional propagation of reference samples from adjacent blocks. With CRS, if a block's reference samples are positioned to the right or below the prediction block, the mode derivation process can be modified to interpolate and propagate samples in the opposite direction, or even use mirrored samples from the reference block to generate better predictions. A specific example might involve a situation where the predicted block lies at a position where the reference samples are mirrored. In such a case, the TIMD process could adjust the angular mode calculation by taking into account the mirrored reference samples, adjusting the prediction angle, and calculating the predicted values accordingly. This flexibility provided by CRS allows for more accurate predictions in cases where the reference sample distribution deviates from the typical alignment used in regular TIMD.

[0204] Deriving from CRS only: For example, all modes in the MPM list are sorted based on the template matching cost of their predictors with CRS. The rest derivation procedures including determining whether TIMD fusion is used, determining whether a non-angular mode is included in the TIMD fusion and derivation of fusion weights are unchanged.

[0205] For example, in the mode selection process, all modes in the MPM list are first sorted based on the template matching cost of their predictors with CRS. After sorting, the mode with the lowest matching cost is selected as the primary candidate for prediction. If TIMD fusion is enabled, the process then checks whether to fuse the selected angular mode with a non-angular mode (such as Planar or DC) . The final prediction is determined by applying the fusion weights to combine the selected modes. While the sorting is adjusted to use CRS-based template matching, the remaining steps, including the decision to apply TIMD fusion and the calculation of fusion weights, follow the standard procedures without any changes.

[0206] Deriving using a mixed metric or into a mixed list: Deriving using a mixed metric or generating a mixed list: As another example, a single list of predictors is created by combining the modes from CRS and the existing TIMD method, sorted based on a combined metric. This metric is determined by the template matching costs of their predictors. In cases where the template areas differ in size, the template matching costs are first normalized to account for these differences. To ensure diversity in the selected predictors, the best predictor is chosen based on the lowest cost, followed by the next best predictor that represents a different IPM prediction angle. As another example, all modes in the MPM list are sorted based on a combined metric determined by the template matching costs of their predictors with CRS and predictors with existing method in TIMD. In case the template sizes are different, all template matching costs shall be first normalized by the template size. For example, when SATD is used as the cost metric, the template matching costs of predictors with CRS and with existing method in TIMD are as follows:

[0207] NT, CRS and NT, TIMD are the number of pixels in the templates.

[0208] The combined metric can be the minimum of the maximum of the prediction mode’s template matching costs from both predictor generation methods. costcombined (mode) =min (costCRS, costTIMD) .

[0209] Or costcombined (mode) =max (costCRS, costTIMD) .

[0210] The combined metric can be the sum of the prediction mode’s template matching costs from both predictor generation methods. costcombined (mode) =costCRS+costTIMD.

[0211] The rest derivation procedures including determining whether TIMD fusion is used, determining whether a non-angular mode is included in the TIMD fusion and derivation of fusion weights are unchanged.

[0212] As another example, the decoder first derives separate sorted lists of IPMs using predictors with CRS and predictors with existing method and chooses the best IPM (with lowest template matching cost) from each sorted list as the derived TIMD modes. derived_modes= {IPM1, CRS, IPM1, TIMD} .

[0213] If both derivation results represent the same mode IPM1, CRS=IPM1, TIMD, the mode derivation outputs a single mode as the result. derived_mode=IPM1, CRS=IPM1, TIMD.

[0214] As another example, the decoder obtains MPM list from both TIMD and TIMD with CRS and combines into one MPM list and perform template matching cost evaluation and sorting. If the second best mode represents the same IPM as the best mode, the next best modes are checked subsequently until all derived modes represent different IPMs.

[0215] In some examples, the prediction method further comprises calculating a template matching cost of the at least one CRS-derived mode using a metric and selecting an IPM with a minimum cost for intra prediction of a current coding unit (CU) . In the mode derivation, one can use various types of metrics as a difference metric, including SATD, SSE, SAD, MSE or other relevant quality assessment metric. As proposed in some examples of this disclosure, for each intra prediction mode in MPMs, the difference between the prediction and reconstruction samples of the CRS template is calculated as the template matching cost. The intra prediction mode with the minimum template matching cost is selected as the CRS-derived mode and used for intra prediction of current CU.

[0216] In some examples, the prediction method further comprises determining a fusion in the TIMD or the TIMD with CRS by comparing a ratio of a template matching cost of a fusion predictor to a template matching cost of an IPM, and applying the fusion if a ratio is below a predetermined threshold. In some examples, the conditions for determining whether fusion is used in TIMD or TIMD with CRS-derived modes. are further modified based on TM cost of the fusion predictor. The fusion predictor is generated using the same rules of calculating a weighted average of two or three IPMs in TIMD fusion. The decision is made by comparing the ratio of the template matching cost of predfusion to the template matching cost of one of the two or three IPM with a threshold. If the ratio of costf to costi is greater than a predetermined threshold, the CRS fusion with the first two intra prediction modes or with non-angular intra mode is not applied.

[0217] For example, the threshold is applied as follows:

[0218] costf and cost2 are the TM costs of predfusion and pred2. The value of TC may be equal to one of the following values: 0.8, 1, 1.2.

[0219] In some examples, the prediction method further comprises modifying at least one reference line for generating the at least one predictor in an intra prediction fusion with CRS. In some examples, the selection of reference lines in intra prediction fusion is modified when CRS-derived modes are used. When generating predictors for the current block using TIMD fusion, the reference line for the second-best mode is shifted one line outside the reference line used for the best mode. To align with the principles of CRS, the reference line for each CRS-derived mode is adjusted to match the reference line used in the mode derivation procedures for generating predictors on the current block.

[0220] To maintain the principle of CRS, for each CRS-derived mode, the reference line used for generating predictors on the current block is modified to the reference line being used in mode derivation procedures. In details, to maintain the principle of CRS, for each CRS-derived mode, the reference line used for generating predictors on the current block is modified to match the reference line used in the mode derivation process. This ensures consistency between the reference samples used during mode derivation and the prediction generation. For example, if the best CRS-derived mode uses a reference line from the top of the block, the second-best mode's reference line would typically be shifted to one line outside of the top reference line, following the TIMD fusion process. However, if CRS dictates that the reference samples can be mirrored or extended in a certain direction (e.g., from the right side of the block) , the reference line for generating the predictors will adjust accordingly. Thus, instead of simply shifting the reference line outside the block, the modified reference line will follow CRS rules, such as using mirrored samples or extended lines, ensuring that the predictors are generated in alignment with CRS-based mode derivation. In this case, if the best mode relies on a left reference line with CRS-based extensions, the second-best mode would similarly use a reference line adjusted according to CRS rules, rather than the default reference line shift used in regular TIMD procedures.

[0221] Embodiment 5: Deriving the usage of CRS-derived modes based on signaling:

[0222] In some examples, the prediction method further comprises controlling the at least one CRS-derived mode in a TIMD by a CRS flag signaled in a bitstream, and the CRS flag is signaled at a block, a slice, a picture, a group of picture, or a sequence parameter set (SPS) level. The use of CRS-derived modes in TIMD can be controlled by several flags signaled in the bitstream. The CRS flag indicates whether the CRS-derived mode is enabled for the current block and can be signaled at different levels, such as block, slice, picture, group of pictures (e.g., in the slice header) , or sequence parameter set (SPS) . For example, the CRS flag is signaled at the coding unit (CU) level when a CU is coded in TIMD mode, and this binary flag can be encoded using context-based coding. Additionally, the CRS mixed mode flag signals whether mode derivation uses a mixture of CRS-based and existing (non-CRS) methods. It can also be signaled at various levels, such as block, slice, picture, group of pictures, or SPS. For instance, the CRS mixed mode flag is signaled at the CU level when a CU is coded in TIMD mode with CRS. If the CRS mixed mode flag is true, mode derivation uses a combined metric or outputs  a mixed list of CRS and non-CRS modes. If the CRS mixed mode flag is false but the CRS flag is true, mode derivation relies solely on CRS predictors. If both flags are false, mode derivation uses existing methods.

[0223] Embodiment 6: Deriving the usage of CRS-derived modes based on decoder-side derivation:

[0224] In some examples, the prediction method further comprises further comprising controlling the at least one CRS-derived mode in a TIMD by a CRS flag derived on the video coder, and the CRS flag is set to true unconditionally or based on at least one factor that determines if the at least one CRS-derived mode is enabled for the current block.

[0225] In some examples, the use of CRS-derived modes in TIMD can be controlled by several flags that are derived on the decoder side. In one embodiment, the CRS flag is always set to true, meaning CRS-derived mode is enabled unconditionally. Whenever template-based prediction, such as TIMD, is performed, CRS-derived mode replaces other template predictors or existing methods. Alternatively, the Derived CRS flag is a control flag that indicates if CRS-derived mode is enabled for the current block, with its value determined by one or more of the following factors:

[0226] Block size or sample size: The CRS flag is applicable to all or specific block / sample sizes. For instance, if the current block has a minimum dimension of 4 luma pixels, the CRS flag is true; otherwise, it is false. Similarly, if the sample size of the current block is 128 or fewer, the CRS flag is true; otherwise, it is false.

[0227] Template matching (TM) cost: The CRS flag is derived based on TM cost. For example, if the TM cost of the best CRS-derived mode is less than the TM cost of the best TIMD mode multiplied by a predefined factor, the CRS flag is set to true. Additionally, when comparing these costs, the calculation may only consider the intersection of the sample sets in both CRS and TIMD templates.

[0228] Features of the template samples: The CRS flag can be determined based on the characteristics of the samples within the template, whether they are predicted or reconstructed samples. For instance, if the gradient of the samples exceeds a certain threshold, the CRS flag is set to true.

[0229] The CRS mixed mode flag can also be derived in different ways: it may be always set to true, always set to false, or derived using a similar process as the CRS flag derivation.

[0230] Embodiment 7: Adding CRS-derived modes to Occurrence-based intra coding (OBIC) histogram of occurrences:

[0231] In this embodiment, the CRS derived modes are added to OBIC histogram of occurrences. In OBIC, besides collecting prediction modes of neighboring block, the CRS-derived modes (the best one, two or three modes, depending on the fusion rules) are provided and counted towards the histogram of occurrences.

[0232] In details, in this embodiment, CRS-derived modes are integrated into the OBIC histogram of occurrences to enhance the mode selection process. In OBIC, prediction modes from neighboring blocks are typically collected and counted. However, in this case, the best CRS-derived modes are also included in the histogram, contributing to a more accurate prediction. Depending on the fusion rules applied, either the top one,  two, or three CRS-derived modes are selected and added to the histogram. For example, suppose the neighboring blocks have the following most frequent prediction modes: Planar, DC, and Angular-45. Normally, these modes would be included in the OBIC histogram. Now, let's say the CRS-derived modes for the current block are Angular-30, Angular-60, and Planar. If the fusion rule dictates adding the top two CRS modes, Angular-30 and Angular-60 would be included in the OBIC histogram alongside the modes from neighboring blocks. This combination allows the OBIC process to consider a wider variety of prediction modes, potentially leading to better coding efficiency and prediction accuracy.

[0233] Embodiment 8: Adding CRS-derived modes to SGPM most probable mode list:

[0234] In this embodiment, the CRS derived modes are added to SGPM MPM list. In SGPM, when the MPM list is being constructed, the CRS-derived modes (the best one, two or three modes, depending on the fusion rules) are provided and added to the SGPM MPM list.

[0235] In details, in this embodiment, CRS-derived modes are incorporated into the SGPM (Spatial Gradient Prediction Mode) MPM list to improve prediction accuracy. When the MPM (Most Probable Mode) list is being constructed in SGPM, CRS-derived modes are included based on the fusion rules applied. Specifically, the best one, two, or three CRS-derived modes are selected and added to the MPM list alongside the existing modes derived from neighboring blocks. For example, during mode derivation, the typical MPM list might include modes such as Planar, DC, and Angular-45, which are based on the prediction modes from neighboring blocks. However, if the CRS process identifies Angular-30, Angular-60, and Planar as the best candidates for the current block, and the fusion rule allows for the top two CRS-derived modes, then Angular-30 and Angular-60 will be added to the SGPM MPM list. As a result, the final MPM list might contain the following modes: Planar, DC, Angular-45 (from neighboring blocks) , along with Angular-30 and Angular-60 (from CRS-derived modes) . This enriched MPM list provides more prediction options, improving the likelihood of selecting the most suitable mode for the current block, thus enhancing coding efficiency.

[0236] Embodiment 9: Adjustment of HoG-based VIPM derivation in SGPM, TIMD modes and CRS-derived modes:

[0237] In some examples, VIPM using the adjustment HoG-based method is adjusted for use in a SGPM mode, a TIMD mode, and / or a CRS-derived mode. In some examples, deriving the VIPM from the prediction block using the adjustment HoG-based method comprises building a HoG of the prediction block and using a first intra prediction mode corresponding to a highest gradient amplitude as the VIPM. In some examples, the VIPM is used to derive a multiple transform selection (MTS) transform set or a low-frequency non-separable transform (LFNST) transform kernel set for coding the current block. In some examples, the VIPM is used to derive a mode candidate list for a subsequent intra prediction block, and / or the VIPM is used for a histogram of occurrence in an OBIC, and / or a most probable mode (MPM) list. In some examples, the adjustment HoG-based method refers to a modification of at least one edge operator for building HoG, a size of the at least one edge operator used in calculating horizontal and vertical gradients of a prediction result is determined based on a coding information of the current block.

[0238] In this embodiment, the HoG-based VIPM derivation is adjusted to SGPM, TIMD modes and CRS-derived modes. In details, in this embodiment, the HoG-based VIPM (Visual Intra Prediction Mode) derivation is adjusted to incorporate SGPM, TIMD, and CRS-derived modes, allowing for more flexible and accurate prediction. The Histogram of Oriented Gradients (HoG) approach typically works by analyzing the gradient orientation of pixel intensities within a block to determine the best intra prediction mode. In this adjusted process, the HoG-based VIPM derivation is expanded to not only include standard prediction modes but also the modes derived from SGPM, TIMD, and CRS.

[0239] In this embodiment, the focus is on modifying the VIPM (Visual Intra Prediction Mode) derivation process specifically for CRS (Contextual Reference Samples) to enhance the accuracy of predictions. The traditional VIPM derivation relies on the Histogram of Gradients (HoG) to select the mode with the highest gradient amplitude as the best prediction mode. For CRS, however, additional adjustments are made to better utilize the reference samples and reflect the unique nature of CRS-derived modes. When CRS is used, the reference lines are often mirrored, extended, or otherwise adjusted compared to regular intra prediction methods. In this modified VIPM derivation, the HoG-based gradient analysis is applied not only to the original reference samples but also to the CRS-derived samples. This means the gradient calculations account for the altered or extended reference lines, which may improve prediction accuracy in complex scenarios where standard prediction modes would struggle. In this embodiment, the gradient calculation in the VIPM derivation can be weighted to prioritize the CRS-derived reference samples. This modification ensures that the CRS samples, which may offer more relevant information for certain prediction blocks, have a higher impact on the final gradient direction chosen for the VIPM. If CRS fusion rules allow for multiple modes (e.g., the top two or three CRS-derived modes) , the VIPM derivation process is modified to consider all applicable CRS-derived modes. Instead of simply selecting the mode with the highest gradient, the algorithm might evaluate several modes and choose the one that offers the best fit for the block, based on both CRS and non-CRS-derived gradients. By modifying the VIPM derivation to incorporate CRS-based reference samples and adapt gradient calculations accordingly, this embodiment ensures that CRS-derived modes are better integrated into the prediction process, leading to improved coding efficiency and accuracy. The use of weighted gradients, consideration of multiple CRS modes, and adjustments to reference lines provide a more nuanced approach to intra prediction when using CRS.

[0240] For instance, the standard HoG-based VIPM method might initially derive prediction modes such as Planar, DC, and Angular-45 from analyzing neighboring blocks. However, with the adjustment, the prediction modes from SGPM (e.g., Angular-30, based on spatial gradients) , TIMD (e.g., Angular-60, based on template matching) , and CRS-derived modes (e.g., mirrored or extended reference lines for certain angles) are now also considered in the HoG-based derivation process. This means that the HoG algorithm not only uses the traditional intra prediction modes but also integrates SGPM, TIMD, and CRS modes into its decision-making.

[0241] For example, if the HoG analysis suggests that a block has a strong angular pattern around 30 degrees, instead of defaulting to a regular angular mode, the system might select the CRS-derived Angular-30 mode or the TIMD Angular-60 mode, depending on which better matches the block's gradient characteristics. This  adjustment allows for more tailored predictions, resulting in improved block reconstruction and overall coding efficiency.

[0242] Derivation and usage of HoG-based VIPM:

[0243] A histogram of gradients (HoG) for the prediction block is constructed similarly to DIMD, and the first intra prediction mode corresponding to the highest gradient amplitude is selected as the VIPM. The process of building the HoG and deriving the VIPM. Once the VIPM is derived from blocks coded using SGPM, TIMD, or TIMD with CRS, it can be used in the following processes: The derived VIPM can be used to determine the MTS transform set or the LFNST transform kernel set for coding the current block. The derived VIPM can assist in deriving the mode candidate list for subsequent intra prediction blocks. When a block is checked with SGPM, TIMD, or TIMD with CRS, the HoG-based derived VIPM is provided. The derived VIPM can also be used for the histogram of occurrences in OBIC. If a block coded with SGPM, TIMD, or TIMD with CRS is checked by a subsequent block being coded in OBIC, the HoG-based derived VIPM is provided.

[0244] Modification of edge operators for building HoG:

[0245] In another implementation, the size of the edge operator used to calculate the horizontal and vertical gradients of the prediction result can be determined based on the coding information of the current block. For example, this coding information could be the minimum side length of the current block or neighboring blocks as illustrated in Table 3.

[0246] Table 3: Coding information as the minimum side length of the current block or neighboring blocks.

[0247] The horizontal and vertical filters of a 2x2 operator are defined as:

[0248] For another example, the coding information may be the sample size of the current block as illustrated in Table 4.

[0249] Table 4: Coding information as the sample size of the current block.

[0250] The horizontal and vertical filters of a 5x5 operator are defined as:

[0251] FIG. 28 illustrates an example of a video coder 1900 according to an embodiment of the present disclosure. The video coder 1900 is configured to implement some embodiments of the disclosure. Some embodiments of the disclosure may be implemented into the video coder 1900 using any suitably configured hardware and / or software. The video coder 1900 may include a memory 1901, a transceiver 1902, and a processor 1903 coupled to the memory 1901 and the transceiver 1902. The processor 1903 may be configured to implement proposed functions, procedures and / or methods described in this description. Layers of radio interface protocol may be implemented in the processor 1903. The memory 1901 is operatively coupled with the processor 1903 and stores a variety of information to operate the processor 1903. The transceiver 1902 is operatively coupled with the processor 1903, and the transceiver 1902 transmits and / or receives a radio signal. The processor 1903 may include application-specific integrated circuit (ASIC) , other chipset, logic circuit and / or data processing device. The memory 1901 may include read-only memory (ROM) , random access memory (RAM) , flash memory, memory card, storage medium and / or other storage device. The transceiver 1902 may include baseband circuitry to process radio frequency signals. When the embodiments are implemented in software, the techniques described herein can be implemented with modules (e.g., procedures, functions, and so on) that perform the functions described herein. The modules can be stored in the memory 1901 and executed by the processor 1903. The memory 1901 can be implemented within the processor 1903 or external to the processor 1903 in which case those can be communicatively coupled to the processor 1903 via various means as is known in the art.

[0252] In some embodiments, the processor 703 is configured to is configured to perform the above prediction method. In some embodiments, a prediction method applied to a video coder includes determining whether a regression-based blending is available in a spatial geometric partitioning mode (SGPM) mode; obtaining a first candidate list; and generating a prediction block for a current block based on a blending mode, wherein the blending mode is determined by the first candidate list, and the blending mode comprises a partition-based blending mode or a regression-based blending mode.

[0253] In some embodiments, obtaining the first candidate list comprises: deriving a regression-based blending candidate list; deriving a partition-based candidate list; and combining the regression-based blending candidate list and the partition-based candidate list to obtain the first candidate list. In some embodiments, model coefficients in the regression-based blending candidate list are derived from a template. In some embodiments, each element in the regression-based blending candidate list contains a combination of a plurality of prediction  modes and a set of model coefficients. In some embodiments, the partition-based candidate list is derived by a template matching (TM) based reordering.

[0254] In some embodiments, the method further comprises decoding a SPGM candidate index. In some embodiments, the blending mode is indicated by the SGPM candidate index. In some embodiments, generating the prediction block for the current block based on the blending mode further comprises: blending results of a plurality of intra prediction modes (IPMs) , block vector-based prediction modes, or inter prediction modes using either a partition-based blending method or a regression-based blending method.

[0255] In some embodiments, a prediction method applied to a video coder includes determining whether a regression-based blending is available in a spatial geometric partitioning mode (SGPM) mode; decoding a regression-based flag; decoding a candidate index for a candidate list, wherein the candidate index for the candidate list indicates whether a partition-based candidate list or a regression-based blending candidate list is based on the regression-based flag; and determining if the regression-based blending is enabled for a current block.

[0256] In some embodiments, the candidate list comprises a regression-based blending candidate list or a partition-based candidate list. In some embodiments, if the regression-based blending is enabled for the current block, deriving the regression-based blending candidate list. In some embodiments, model coefficients in the regression-based blending candidate list are derived from a template. In some embodiments, each element in the regression-based blending candidate list contains a combination of a plurality of prediction modes and a set of model coefficients. In some embodiments, if the regression-based blending is disabled for the current block, deriving the partition-based blending candidate list.

[0257] In some embodiments, the method further comprises generating a prediction block for a current block based on a blending mode, wherein the blending mode is determined by the candidate list. In some embodiments, generating the prediction block for the current block based on the blending mode further comprises: blending results of a plurality of intra prediction modes (IPMs) , block vector-based prediction modes, or inter prediction modes using either a partition-based blending method or a regression-based blending method.

[0258] In some embodiments, a prediction method applied to a video coder includes determining whether a template-based intra mode derivation (TIMD) fusion is applied; if the TIMD fusion is enabled for a current block, deriving a regression-based blending candidate list; and generating a prediction block for the current block based on the regression-based blending candidate list.

[0259] In some embodiments, model coefficients in the regression-based blending candidate list are derived from a template. In some embodiments, each element in the regression-based blending candidate list contains a combination of a plurality of prediction modes and a set of model coefficients. In some embodiments, the method further comprises determining whether a regression-based blending is available in a TIMD mode and deriving the TIMD mode form most probable modes (MPMs) . In some embodiments, if the TIMD fusion is disabled, selecting an intra predication mode with a minimum template cost for intra predication. In some embodiments, generating the prediction block for the current block based on the regression-based blending candidate list comprises: predicting a first current block using a partition-based blending mode; predicting a second current  block using a regression-based blending mode; and fusing the first current block and the second current block based on the regression-based blending candidate list.

[0260] In some embodiments, a prediction method applied to a video coder includes dividing a candidate index into a plurality of groups; encoding the plurality of groups with different coding methods, wherein for a first group of the candidate index, using a context-based code, a binary code, a unary code, or Golomb code, and for a second group of the candidate index, using a truncated binary code.

[0261] In some embodiments, the first group of the candidate index are most probable indices. In some embodiments, the method further comprises using at least one binarized value coding with context to determine one group. In some embodiments, the first group of the candidate index or the second group of the candidate index contains zero or more elements.

[0262] Commercial interests for some embodiments are as follows. 1. Providing at least one improvement for video coding. 2. Solving issues in the prior arts and / or other issues. 3. Some embodiments of the present disclosure can be used in many applications. 4. Some embodiments of the present disclosure are used by chipset vendors, video system development vendors, automakers including cars, trains, trucks, buses, bicycles, moto-bikes, helmets, and etc., drones (unmanned aerial vehicles) , smartphone makers, communication devices for public safety use, AR / VR / MR device maker for example gaming, conference / seminar, education purposes. Some embodiments of the present disclosure are a combination of “techniques / processes” that can be adopted in video standards to create an end product. Some embodiments of the present disclosure propose technical mechanisms. The at least one proposed solution, method, system, and apparatus of some embodiments of the present disclosure may be used for current and / or new / future G-PCC coding standards, especially for audio video coding standard (AVS) GPCC (GPCC refers to G-PCC) . Compatible products follow at least one proposed solution, method, system, and apparatus of some embodiments of the present disclosure. The proposed solution, method, system, and apparatus of some embodiments of the present disclosure are widely used in the G-PCC related products.

[0263] FIG. 29 is an example of a computing device 1500 according to an embodiment of the present disclosure. Any suitable computing device can be used for performing the operations described herein. For example, FIG. 29 illustrates an example of the computing device 1500 that can implement some embodiments of FIG. 1 to FIG. 28 using any suitably configured hardware and / or software. In some embodiments, the computing device 1500 can include a processor 1512 that is communicatively coupled to a memory 1514 and that executes computer-executable program code and / or accesses information stored in the memory 1514. The processor 1512 may include a microprocessor, an application-specific integrated circuit ( “ASIC” ) , a state machine, or other processing device. The processor 1512 can include any of a number of processing devices, including one. Such a processor can include or may be in communication with a computer-readable medium storing instructions that, when executed by the processor 1512, cause the processor to perform the operations described herein.

[0264] The memory 1514 can include any suitable non-transitory computer-readable medium. The computer-readable medium can include any electronic, optical, magnetic, or other storage device capable of providing a processor with computer-readable instructions or other program code. Non-limiting examples of a computer- readable medium include a magnetic disk, a memory chip, a read-only memory (ROM) , a random access memory (RAM) , an application specific integrated circuit (ASIC) , a configured processor, optical storage, magnetic tape or other magnetic storage, or any other medium from which a computer processor can read instructions. The instructions may include processor-specific instructions generated by a compiler and / or an interpreter from code written in any suitable computer-programming language, including, for example, C, C++, C#, visual basic, java, python, perl, javascript, and actionscript.

[0265] The computing device 1500 can also include a bus 1516. The bus 1516 can communicatively couple one or more components of the computing device 1500. The computing device 1500 can also include a number of external or internal devices such as input or output devices. For example, the computing device 1500 is illustrated with an input / output ( “I / O” ) interface 1518 that can receive input from one or more input devices 1520 or provide output to one or more output devices 1522. The one or more input devices 1520 and one or more output devices 1522 can be communicatively coupled to the I / O interface 1518. The communicative coupling can be implemented via any suitable manner (e.g., a connection via a printed circuit board, connection via a cable, communication via wireless transmissions, etc. ) . Non-limiting examples of input devices 1520 include a touch screen (e g., one or more cameras for imaging a touch area or pressure sensors for detecting pressure changes caused by a touch) , a mouse, a keyboard, or any other device that can be used to generate input events in response to physical actions by a user of a computing device. Non-limiting examples of output devices 1522 include a liquld crystal display (LCD) screen, an external monitor, a speaker, or any other device that can be used to display or otherwise present outputs generated by a computing device.

[0266] The computing device 1500 can execute program code that configures the processor 1512 to perform one or more of the operations described above with respect to some embodiments of FIG. 1 to FIG. 28. The program code can include an encoder 1526 and / or a video decoder 1528. The program code may be resident in the memory 1514 or any suitable computer-readable medium and may be executed by the processor 1512 or any other suitable processor.

[0267] The computing device 1500 can also include at least one network interface device 1524. The network interface device 1524 can include any device or group of devices suitable for establishing a wired or wireless data connection to one or more data networks 1528. Non limiting examples of the network interface device 1524 include an Ethernet network adapter, a modem, and / or the like. The computing device 1500 can transmit messages as electronic or optical signals via the network interface device 1524.

[0268] FIG. 30 is a block diagram of an example of a communication system 1600 according to an embodiment of the present disclosure. Embodiments described herein may be implemented into the communication system 1600 using any suitably configured hardware and / or software. FIG. 16 illustrates the communication system 1600 including a radio frequency (RF) circuitry 1610, a baseband circuitry 1620, an application circuitry 1630, a memory / storage 1640, a display 1650, a camera 1660, a sensor 1670, and an input / output (I / O) interface 1680, coupled with each other at least as illustrated.

[0269] The application circuitry 1630 may include a circuitry such as, but not limited to, one or more single-core or multi-core processors. The processors may include any combination of general-purpose processors and dedicated processors, such as graphics processors, application processors. The processors may be coupled with  the memory / storage and configured to execute instructions stored in the memory / storage to enable various applications and / or operating systems running on the system. The communication system 1600 can execute program code that configures the application circuitry 1630 to perform one or more of the operations described above with respect to FIGS. 1-19. The program code may be resident in the application circuitry 1630 or any suitable computer-readable medium and may be executed by the application circuitry 1630 or any other suitable processor.

[0270] The baseband circuitry 1620 may include circuitry such as, but not limited to, one or more single-core or multi-core processors. The processors may include a baseband processor. The baseband circuitry may handle various radio control functions that may enable communication with one or more radio networks via the RF circuitry. The radio control functions may include, but are not limited to, signal modulation, encoding, decoding, radio frequency shifting, etc. In some embodiments, the baseband circuitry may provide for communication compatible with one or more radio technologies. For example, in some embodiments, the baseband circuitry may support communication with an evolved universal terrestrial radio access network (EUTRAN) and / or other wireless metropolitan area networks (WMAN) , a wireless local area network (WLAN) , a wireless personal area network (WPAN) . Embodiments in which the baseband circuitry is configured to support radio communications of more than one wireless protocol may be referred to as multi-mode baseband circuitry.

[0271] In various embodiments, the baseband circuitry 1620 may include circuitry to operate with signals that are not strictly considered as being in a baseband frequency. For example, in some embodiments, baseband circuitry may include circuitry to operate with signals having an intermediate frequency, which is between a baseband frequency and a radio frequency. The RF circuitry 1610 may enable communication with wireless networks using modulated electromagnetic radiation through a non-solid medium. In various embodiments, the RF circuitry may include switches, filters, amplifiers, etc. to facilitate the communication with the wireless network. In various embodiments, the RF circuitry 1610 may include circuitry to operate with signals that are not strictly considered as being in a radio frequency. For example, in some embodiments, RF circuitry may include circuitry to operate with signals having an intermediate frequency, which is between a baseband frequency and a radio frequency.

[0272] In various embodiments, the transmitter circuitry, control circuitry, or receiver circuitry discussed above with respect to some embodiments of FIG. 1 to FIG. 28 may be embodied in whole or in part in one or more of the RF circuitry, the baseband circuitry, and / or the application circuitry. As used herein, “circuitry” may refer to, be part of, or include an application specific integrated circuit (ASIC) , an electronic circuit, a processor (shared, dedicated, or group) , and / or a memory (shared, dedicated, or group) that execute one or more software or firmware programs, a combinational logic circuit, and / or other suitable hardware components that provide the described functionality. In some embodiments, the electronic device circuitry may be implemented in, or functions associated with the circuitry may be implemented by, one or more software or firmware modules. In some embodiments, some or all of the constituent components of the baseband circuitry, the application circuitry, and / or the memory / storage may be implemented together on a system on a chip (SOC) . The memory / storage 1640 may be used to load and store data and / or instructions, for example, for system. The memory / storage for one embodiment may include any combination of suitable volatile memory, such as dynamic random access memory (DRAM) ) , and / or non-volatile memory, such as flash memory.

[0273] In various embodiments, the I / O interface 1680 may include one or more user interfaces designed to enable user interaction with the system and / or peripheral component interfaces designed to enable peripheral component interaction with the system. User interfaces may include, but are not limited to a physical keyboard or keypad, a touchpad, a speaker, a microphone, etc. Peripheral component interfaces may include, but are not limited to, a non-volatile memory port, a universal serial bus (USB) port, an audio jack, and a power supply interface. In various embodiments, the sensor 1670 may include one or more sensing devices to determine environmental conditions and / or location information related to the system. In some embodiments, the sensors may include, but are not limited to, a gyro sensor, an accelerometer, a proximity sensor, an ambient light sensor, and a positioning unit. The positioning unit may also be part of, or interact with, the baseband circuitry and / or RF circuitry to communicate with components of a positioning network, e.g., a global positioning system (GPS) satellite.

[0274] In various embodiments, the display 1650 may include a display, such as a liquid crystal display and a touch screen display. In various embodiments, the communication system 1600 may be a mobile computing device such as, but not limited to, a laptop computing device, a tablet computing device, a netbook, an ultrabook, a smartphone, an AR / VR glasses, etc. In various embodiments, system may have more or less components, and / or different architectures. Where appropriate, methods described herein may be implemented as a computer program. The computer program may be stored on a storage medium, such as a non-transitory storage medium.

[0275] A person having ordinary skill in the art understands that each of the units, algorithm, and steps described and disclosed in the embodiments of the present disclosure are realized using electronic hardware or combinations of software for computers and electronic hardware. Whether the functions run in hardware or software depends on the condition of application and design requirement for a technical plan. A person having ordinary skill in the art can use different ways to realize the function for each specific application while such realizations should not go beyond the scope of the present disclosure. It is understood by a person having ordinary skill in the art that he / she can refer to the working processes of the system, device, and unit in the above-mentioned embodiment since the working processes of the above-mentioned system, device, and unit are basically the same. For easy description and simplicity, these working processes will not be detailed.

[0276] It is understood that the disclosed system, device, and method in the embodiments of the present disclosure can be realized with other ways. The above-mentioned embodiments are exemplary only. The division of the units is merely based on logical functions while other divisions exist in realization. It is possible that a plurality of units or components are combined or integrated in another system. It is also possible that some characteristics are omitted or skipped. On the other hand, the displayed or discussed mutual coupling, direct coupling, or communicative coupling operate through some ports, devices, or units whether indirectly or communicatively by ways of electrical, mechanical, or other kinds of forms.

[0277] The units as separating components for explanation are or are not physically separated. The units for display are or are not physical units, that is, located in one place or distributed on a plurality of network units. Some or all of the units are used according to the purposes of the embodiments. Moreover, each of the functional units in each of the embodiments can be integrated in one processing unit, physically independent, or integrated in one processing unit with two or more than two units.

[0278] If the software function unit is realized and used and sold as a product, it can be stored in a readable storage medium in a computer. Based on this understanding, the technical plan proposed by the present disclosure can be essentially or partially realized as the form of a software product. Or, one part of the technical plan beneficial to the conventional technology can be realized as the form of a software product. The software product in the computer is stored in a storage medium, including a plurality of commands for a computational device (such as a personal computer, a server, or a network device) to run all or some of the steps disclosed by the embodiments of the present disclosure. The storage medium includes a USB disk, a mobile hard disk, a read-only memory (ROM) , a random access memory (RAM) , a floppy disk, or other kinds of media capable of storing program codes.

[0279] While the present disclosure has been described in connection with what is considered the most practical and preferred embodiments, it is understood that the present disclosure is not limited to the disclosed embodiments but is intended to cover various arrangements made without departing from the scope of the broadest interpretation of the appended claims.

Claims

1.A prediction method applied to a video coder, comprising:determining at least one reference sample and at least one template, wherein the at least one reference sample and the at least one template are defined by a reference line of a current block; andgenerating at least one predictor on the at least one template based on the at least one reference sample.2.The prediction method of claim 1, wherein the at least one reference sample and the at least one template are defined by the reference line of the current block comprises:the at least one reference sample comprises samples in a first reference line area and a second reference line area; andthe at least one template comprising an above template area and a left template area.3.The prediction method of claim 2, wherein the samples in the first reference line area are same as samples used for prediction of the current block, and the samples in the second reference line area are extended from the reference line of the current block.4.The prediction method of claim 2, wherein when an index of the reference line is not equal to 0 and the at least one template is not overlapped with the reference line, the above template area is above the reference line and the left template area is to a left of the reference line.5.The prediction method of claim 4, wherein when an index of the reference line is not equal to 0 and the at least one template is overlapped with the reference line, the above template area has a first above sub-area and a second above sub-area, the left template area has a first left sub-area and a second left sub-area, the first above sub-area is above the reference line and the second above sub-area is between the reference line and the current block, and the first left sub-area is to a left of the reference line and the second left sub-area is between the reference line and the current block.6.The prediction method of claim 1, wherein a size of the at least one template is determined by a size of the current block.7.The prediction method of claim 6, wherein when the size of the current block is greater than a threshold, the size of the at least one template is 4x4.8.The prediction method of claim 6, wherein when the size of the current block is smaller or equal to a threshold, the size of the at least one template is 2x2.9.The prediction method of claim 1, wherein when an index of the reference line is greater than a predetermined threshold, an area of the at least one template is between the reference line and the current block.10.The prediction method of any one of claims 1 to 9, further comprising:applying a position-dependent intra prediction combination (PDPC) on the least one predictor.11.The prediction method of any one of claims 1 to 10, wherein the at least one reference sample is used for the at least one predictor on the current block.12.The prediction method of any one of claims 1 to 11, wherein generating the at least one predictor on the at least one template based on the at least one reference sample comprises:generating a predicted sample based on four points surrounding the at least one template, wherein the predicted sample comprises two orthogonal projection samples and two additional reference samples, and the two additional reference samples are mirrored relative to the at least one template.13.The prediction method of any one of claims 1 to 12, wherein a prediction location of the at least one predictor is defined based on an adjustment angular mode.14.The prediction method of claim 13, wherein in the adjustment angular mode, a set of directions supported by the video coder are used for the at least one predictor; and / or the reference line is extended relative to the at least one template.15.The prediction method of any one of claims 10 to 14, wherein applying the PDPC on the at least one predictor comprises:determining applicability to specific angles, wherein applying the PDPC on the at least one predictor is applicable to a factor, the factor refers that a sample to be predicted is located between intersects of a prediction line and reference lines, and the prediction line is related to the current block, passes through the sample to be predicted, and extends along a prediction direction.16.The prediction method of any one of claims 10 to 15, wherein applying the PDPC on the at least one predictor comprises:determining a PDPC weight for the at least one reference sample based on a relative distance of a prediction sample in the at least one template and the at least one reference sample.17.A prediction method applied to a video coder, comprising:using common reference sample (CRS) -derived mode and / or non-CRS method to generate predictor for a current block;generating prediction block based on template from a most probable mode (MPM) list; and / oradding the CRS-derived mode to candidate list of a prediction mode.18.The prediction method of claim 17, wherein using the CRS-derived mode and / or the non-CRS method to generate the predictor for the current block comprises:deriving using the CRS-derived mode to generate the predictor for each IPM in the MPM list with CRS in a template-based intra mode derivation (TIMD) .19.The prediction method of claim 18, further comprising determining a fusion in the TIMD or the TIMD with CRS by comparing a ratio of a template matching cost of a fusion predictor to a template matching cost of an IPM, and applying the fusion if a ratio is below a predetermined threshold.20.The prediction method of claim 17, wherein using the CRS-derived mode and / or the non-CRS method to generate the predictor for the current block comprises:deriving using a combined metric to generate the predictor for each IPM in the MPM list with CRS and without CRS in TIMD;wherein deriving using the combined metric comprises:using the CRS-derived mode to calculate a first cost for the same IPM in the same set of MPM lists; using the non-CRS method to calculate a second cost for the same IPM in the same set of MPM lists; generating the combined metric based on the first cost and the second cost; andsorting IPMs in the MPM list based on the combined metric.21.The prediction method of claim 17, wherein using the CRS-derived mode and / or the non-CRS method to generate the predictor for the current block comprises:deriving using a mixed list to generate the predictor for each IPM in the MPM list with CRS and without CRS in TIMD, wherein deriving using the mixed list comprises:using the CRS-derived mode to calculate a first cost for the same IPM in the same set of MPM lists; using the non-CRS method to calculate a second cost for the same IPM in the same set of MPM lists; generating a first list based on the first cost;generating a second list based on the second cost; andgenerating the mixed list based on the first list and the second list.22.The prediction method of claim 17, further comprising calculating a template matching cost of the CRS-derived mode using a metric and selecting an IPM with a minimum cost for intra prediction of a current coding unit (CU) .23.The prediction method of claim 17, further comprising modifying reference line for generating the predictor in an intra prediction fusion with CRS.24.The prediction method of claim 17, further comprising controlling the CRS-derived mode in a TIMD by a CRS flag signaled in a bitstream, and the CRS flag is signaled at a block, a slice, a picture, a group of picture, or a sequence parameter set (SPS) level.25.The prediction method of claim 17, further comprising controlling the CRS-derived mode in a TIMD by a CRS flag derived on the video coder, and the CRS flag is set to true unconditionally or based on factor that determines if the CRS-derived mode is enabled for the current block.26.The prediction method of claim 17, wherein adding the CRS-derived mode to the candidate list of the prediction mode comprises:deriving and executing the candidate list, wherein IPM in the candidate list comprises intra prediction mode, intra block copy (IBC) mode, decoder side intra mode derivation (DIMD) mode, template-based intra mode derivation (TIMD) -derived mode, and / or CRS-derived mode.27.The prediction method of claim 26, wherein the IPM from blocks coded in spatial geometry partition mode (SGPM) , the TIMD-derived mode without CRS, and / or the TIMD-derived mode with CRS comprise a virtual intra prediction mode (VIPM) derived using a histogram of gradients (HoG) -based method.28.The prediction method of claim 26 or 27, wherein the candidate list comprises spatial geometry partition mode (SGPM) candidate list.29.A prediction method applied to a video coder, comprising:decoding block coded in a template-based intra mode derivation (TIMD) fusion, with or without common reference sample (CRS) , and / or a spatial geometry partition mode (SGPM) to obtain a prediction block; andderiving a virtual intra prediction mode (VIPM) from the prediction block using an adjustment histogram of gradients (HoG) -based method.30.The prediction method of claim 29, wherein VIPM using the adjustment HoG-based method is adjusted for use in a SGPM mode, a TIMD mode, and / or a CRS-derived mode.31.The prediction method of claim 29 or 30, wherein deriving the VIPM from the prediction block using the adjustment HoG-based method comprises:building a HoG of the prediction block and using a first intra prediction mode corresponding to a highest gradient amplitude as the VIPM.32.The prediction method of any one of claims 29 to 31, wherein the VIPM is used to derive a multiple transform selection (MTS) transform set or a low-frequency non-separable transform (LFNST) transform kernel set for coding the current block.33.The prediction method of any one of claims 29 to 31, wherein the VIPM is used to derive a mode candidate list for a subsequent intra prediction block, and / or the VIPM is used for a histogram of occurrence in an OBIC, and / or a most probable mode (MPM) list.34.The prediction method of any one of claims 29 to 33, wherein the adjustment HoG-based method refers to a modification of edge operator for building HoG, a size of the edge operator used in calculating horizontal and vertical gradients of a prediction result is determined based on a coding information of the current block.35.A video coder, comprising:a memory;a transceiver; anda processor coupled to the memory and the transceiver;wherein the processor is configured to perform the method of any one of claims 1 to 34.36.A non-transitory machine-readable storage medium having stored thereon instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 34.37.A chip, comprising:a processor, configured to call and run a computer program stored in a memory, to cause a device in which the chip is installed to execute the method of any one of claims 1 to 34.38.A computer readable storage medium, in which a computer program is stored, wherein the computer program causes a computer to execute the method of any one of claims 1 to 34.39.A computer program product, comprising a computer program, wherein the computer program causes a computer to execute the method of any one of claims 1 to 34.40.A computer program, wherein the computer program causes a computer to execute the method of any one of claims 1 to 34.