Decoding method and encoding method applying filter coefficient update and apparatus incorporating the same

By updating filters through coefficient trimming and truncation, the method addresses inefficiencies in current video compression technologies, enhancing coding efficiency and reducing computational overhead.

WO2026137260A1PCT designated stage Publication Date: 2026-07-02SHENZHEN TCL NEW-TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SHENZHEN TCL NEW-TECH CO LTD
Filing Date
2024-12-25
Publication Date
2026-07-02

AI Technical Summary

Technical Problem

Current image and video compression technologies face challenges in balancing computational complexity, precision, tap length, and coefficient pruning strategies in interpolation filters, particularly in high-precision environments, leading to inefficiencies and increased complexity.

Method used

A method and apparatus for decoding and encoding that involve determining reference samples, selecting and updating filters by trimming or truncating coefficients to optimize filter performance, reducing computational overhead while maintaining precision.

Benefits of technology

The method enhances video coding efficiency by balancing computational complexity and precision, improving interpolation accuracy and reducing resource demands in hardware implementations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024142388_02072026_PF_FP_ABST
    Figure CN2024142388_02072026_PF_FP_ABST
Patent Text Reader

Abstract

A decoding method and an encoding method applying filter coefficient update are provided. The decoding method includes: determining a plurality of reference samples for a prediction mode; determining a prototype filter; acquiring an updated filter based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter; and filtering the plurality of reference samples with the updated filter to generate predicted samples of a current block.
Need to check novelty before this filing date? Find Prior Art

Description

DECODING METHOD AND ENCODING METHOD APPLYING FILTER COEFFICIENT UPDATE AND APPARATUS INCORPORATING THE SAMETECHNICAL FIELD

[0001] The present disclosure generally relates to encoding and decoding technology, and in particular to a decoding method and an encoding method applying filter coefficient update, an apparatus for decoding or encoding, and a computer readable non-transitory medium.BACKGROUND

[0002] Image and video compression are key techniques in digital media processing, used to reduce redundancy within frames by predicting pixel values based on neighboring sample pixels within the same frame or a different frame. These techniques help code images more efficiently by exploiting spatial correlations.

[0003] Several prediction modes are employed, including DC Mode, Planar Mode, and Angular Mode, each designed to predict pixel values differently based on the structure of the block being encoded. In DC mode, the entire block is predicted using the average of the reference samples around the block. This mode is often used for flat or smooth regions, where the pixel values don’ t change significantly. Planar mode predicts the pixel values by interpolating between the horizontal and vertical reference samples. It works well in regions with gentle gradients or smooth transitions. Angular mode predicts the pixel values along specific angles based on the direction of the texture in the block.

[0004] In Angular Mode as an example, several filters are used to achieve accurate predictions, which are interpolation and smoothing. A simple modification of increasing the number of samples to be used for filtering also improves the coding performance. When a predictor is generated using the angular prediction mode, the position of the reference pixel that the current pixel exploits the best may not fall at an integer pixel position.

[0005] Two filtering mechanisms for reference samples are employed: reference sample smoothing and interpolation filtering. Reference sample smoothing modifies reference samples using a finite impulse response filter. This filter eliminates the need for multiplication operations, simplifying the design compared to methods which rely on interpolation filters.

[0006] The Enhanced Compression Mode (ECM) utilizes a 6-tap interpolation filter to refine the reference samples surrounding the current intra prediction block. The Interpolation Filtering is used for fractional-slope modes. When a sample projection falls on a fractional position between reference samples, interpolation filtering is applied to obtain the predicted sample value. This approach is advantageous because it allows for a more precise estimation of sample values that lie between the available reference samples, effectively capturing finer details and variations in the image.

[0007] In the current design of interpolation filters, several challenges emerge when balancing computational complexity, precision, tap length, and coefficient pruning strategies.SUMMARY

[0008] Accordingly, the present disclosure aims to provide a decoding method and an encoding method applying filter coefficient update, an apparatus for decoding or encoding, and a computer readable non-transitory medium.

[0009] A technical scheme adopted by the present disclosure is to provide a decoding method. The method includes: determining a plurality of reference samples for a prediction mode; determining a prototype filter; acquiring an updated filter based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter; and filtering the plurality of reference samples with the updated filter to generate predicted samples of a current block.

[0010] Another technical scheme adopted by the present disclosure is to provide a decoding method. The method includes: determining a plurality of reference samples for a prediction mode; determining a first prototype filter and a second prototype filter; acquiring a first updated filter based on the first prototype filter by trimming and / or truncating one or more coefficients of the first prototype filter; acquiring a second updated filter based on the second prototype filter by trimming and / or truncating one or more coefficients of the second prototype filter; selecting a target filter from the first updated filter and the second updated filter; and filtering the plurality of reference samples with the target filter to generate predicted samples of a current block.

[0011] Another technical scheme adopted by the present disclosure is to provide a decoding method. The method includes: determining a plurality of reference samples for a prediction mode; determining a prototype filter; acquiring an updated filter based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter; and filtering the plurality of reference samples with the updated filter to generate predicted samples of a current block.

[0012] Another technical scheme adopted by the present disclosure is to provide an apparatus for video decoding or encoding. The apparatus includes a processor and a memory. The memory is configured to store executable instructions that, when executed by the processor, cause the processor to perform any of the foregoing methods.

[0013] Another technical scheme adopted by the present disclosure is to provide a computer readable medium. The computer readable medium is configured to store executable instructions that, when executed by the processor, cause the processor to perform any of the foregoing methods.BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to clearly explain the technical solutions in the embodiments of the present disclosure, the drawings used in the description of the embodiments will be briefly described below. Obviously, the drawings in the following description are merely some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings may also be obtained based on these drawings without any creative work.

[0015] FIG. 1 illustrates a reference sample filtering process with a 6-tap interpolation filter.

[0016] FIG. 2 is a flowchart of a decoding method applying filter coefficient update according to an embodiment of the present disclosure.

[0017] FIG. 3 is a flowchart of a decoding method applying filter coefficient update according to another embodiment of the present disclosure.

[0018] FIG. 4 shows a scenario where filter selection is adopted for extended reference line.

[0019] FIG. 5 is a flowchart of a decoding method applying filter coefficient update according to yet another embodiment of the present disclosure.

[0020] FIG. 6 is a flowchart of an encoding method applying filter coefficient update according to an embodiment of the present disclosure.

[0021] FIG. 7 is a schematic diagram of an apparatus for decoding or encoding according to an embodiment of the present disclosure.DETAILED DESCRIPTION

[0022] The disclosure will now be described in detail with reference to the accompanying drawings and examples. Apparently, the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0023] The Enhanced Compression Mode (ECM) aims to enhance video coding efficiency beyond the capabilities of H. 266 / Versatile Video Coding (VVC) . One of the techniques employed in ECM is the avoidance of signaling a selected intra prediction mode by deriving it at both the encoder and decoder using previously encoded / decoded samples.

[0024] The use of interpolation filtering for fractional slope modes is particularly beneficial because it retains more high-frequency information, which is essential for accurately predicting sharp edges and detailed textures. This capability is crucial in scenarios where the reference samples may not align perfectly with the desired prediction direction, thus enhancing the overall quality of the reconstructed video.

[0025] This reference sample interpolation process is integrated with several other tools, such as DIMD, TIMD, TMRL, OBIC, and SGPM, to enhance the reference samples as part of the intra prediction angular mode. The interpolation filter set in ECM comprises several filters. In the development of ECM serval filter is been proposed. A 6-tap gaussian filter is applied for larger blocks (W >= 32 and H >=32) , existing VVC 4-tap gaussian interpolation filter is applied otherwise. The extended intra reference samples are derived using the 4-tap interpolation filter instead of the nearest neighbor rounding.

[0026] To optimize the interpolation process, ECM incorporates mode-dependent intra smoothing (MDIS) rules similar to those used in HEVC. These rules determine which of the two filters, DCT-IF or SIF, is used for interpolation based on the specific intra prediction mode. Chroma blocks are interpolated using a conventional linear filter.

[0027] The present disclosure relates generally to the field of picture / video coding, and specifically to the improvement of reference sample filtering technique that may be used for an intra or inter prediction mode. The following sections provide introduction for several related technologies of the present disclosure, including: 1) reference sample filtering; 2) application field of reference sample interpolation; 3) truncated Lagrange filter; and 4) existing filter selection / adaptation method. ● Reference sample filtering

[0028] In VVC Reference sample filtering plays a vital role in improving the accuracy of predicted sample values, particularly when the prediction direction falls on a fractional position between reference samples. Two main mechanisms are used in reference sample filtering: interpolation filtering and smoothing.

[0029] The first mechanism is interpolation filtering. As shown in FIG. 1, when a sample projection for a given prediction direction falls on a fractional position between reference samples, the predicted sample value is obtained by applying an interpolation filter to the reference samples around the fractional position. For luma blocks, 6-tap interpolation filters are employed in VVC. A 4-tap interpolation is used for the reference extension.

[0030] The predicted sample, denoted as pred (x, y) , is calculated using the formula:

[0031] In the formula, i0 represents the closest left-side integer position of the projected sample within the reference samples r. p indicates the fractional part of the predicted sample's projection at a 1 / 32-pel accuracy. The interpolation filter coefficients, denoted as f [p] [i] , are signed integers with 6-bit precision. These coefficients either represent a DCT-based interpolation filter (DCTIF) or a 4-tap smoothing interpolation filter (SIF) .

[0032] For chroma components, the same linear 2-tap interpolation filter of HEVC is applied. The interpolation filter type is not explicitly signaled in the bitstream. Instead, it is determined by the block size and intra prediction mode index m. If min (∣m-50∣, ∣m-18∣) >T, the SIF is used; otherwise, the DCTIF is applied. Here, T is a threshold that depends on the block size.

[0033] The second mechanism is smoothing filtering. In some cases, reference samples undergo smoothing before prediction to reduce noise and improve prediction accuracy, particularly for integer-slope modes in luma blocks. The smoothing is performed using a finite impulse response (FIR) filter, such as the {1, 2, 1}  / 4 filter. This is especially beneficial for larger blocks, where suppressing discontinuities and high-frequency noise in reference samples can significantly improve the quality of the reconstructed image. ● Application field of reference sample interpolation

[0034] Three techniques, including Template-based Intra Mode Derivation (TIMD) , Decoder-side Intra Mode Derivation (DIMD) , and Template-based Multi-Reference Line Intra Prediction (TMRL) , rely on the processing of reference samples or reference lines, with interpolation filtering playing a key role. Below is an explanation of the scope and benefits of each technique with respect to the usage of interpolation filtering.

[0035] As for TIMD, JVET-V0098 introduces a template-based intra mode derivation (TIMD) method. This method calculates template costs for the most probable modes (MPM) list based on neighboring areas of previously reconstructed samples. These neighboring areas are located above and to the left of the current block.

[0036] For each mode in the MPM list, a sum of the template costs for the template areas is calculated. The mode with the smallest sum of template costs is selected as the TIMD mode. The encoder can indicate a flag to signal that a TIMD mode was selected for a block, avoiding explicit signaling of the intra prediction mode. On the decoder side, based on this indication, the intra prediction mode can be restored by performing the same MPM list check as the encoder. The size of a TIMD template is determined according to the size of the block.

[0037] Position dependent intra prediction combination (PDPC) is included in the derivation of the TIMD mode.

[0038] For each generated prediction, the encoder and decoder may then determine a template cost that is estimated as a prediction error based on a difference between the prediction samples determined for the intra prediction mode and the reconstructed samples of template. For example, a sum of squared differences (SSD) , a sum of absolute differences (SAD) , or a sum of absolute transformed differences (SATD) could be used as a template cost metric. The selected intra prediction mode may be referred to as the “TIMD intra prediction mode” and may be selected from the larger set of intra prediction modes (e.g., the set of 129 angular intra prediction modes) available to TIMD.

[0039] It should be noted that other selection criteria may be used to select an intra prediction mode from the applied intra prediction modes. In another example, the encoder and decoder may select the two intra prediction modes, from the applied intra prediction modes, that result in the first and second smallest predictions errors for a template area in a process referred to as “TIMD fusion. ” The encoder and decoder may use the two intra prediction modes by predicting current block using each of the two intra prediction modes and computing a final predictor based on a weighted average of each prediction determined using the two intra prediction modes.

[0040] Sizes of the template areas used in TIMD and DIMD methods are different from each other. Moreover, in ECM design, these two methods are alternative to each other: either TIMD or DIMD method is used to get one or several intra prediction modes for a current block, but not both methods.

[0041] The use of interpolation filtering, particularly with different tap filters, improves prediction accuracy by weighting the reference samples based on their fractional positions relative to the current block. This allows for smoother transitions between reference samples and enhances the quality of prediction in areas with complex directional patterns.

[0042] As for TMRL, Template-based multiple reference line intra prediction (TMRL) mode combines reference line and prediction mode together and uses a template matching method to construct a list of candidate combinations. An index to the candidate combination list is coded to indicate which reference line and prediction mode is used in coding the current block.

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

[0044] Each element of the TMRL candidate list comprises the template cost, reference line and intra prediction mode. Out of the 50 candidates, only 20 combinations that provide minimum template cost are selected. These 20 candidates are sorted in ascending order by the cost values.

[0045] The use of multiple reference lines provides TMRL with flexibility in choosing the most relevant reference data for a given block. Interpolation filtering is used to smooth the transition between these reference lines and the current block, especially when predicting from non-adjacent reference lines. The SAD-based template matching method ensures that the most accurate prediction is selected, and the usage of interpolation helps minimize prediction errors when reference lines are far from the current block. This results in better quality intra-prediction, especially in larger blocks or blocks with complex directional patterns. ● Truncated Lagrange Filter

[0046] In the realm of signal processing, fractional delay (FD) filters are essential for various applications, including sampling rate conversion and digital waveguide synthesis. Traditional Lagrange interpolation is widely used to design finite impulse response (FIR) filters that approximate fractional delays. By increasing the tap length of the prototype filter, the frequency response performance can be significantly enhanced, allowing for a more accurate approximation of ideal frequency characteristics. For instance, the High Efficiency Video Coding (HEVC) standard employs a 4-tap filter for intra prediction, which effectively interpolates fractional directions in video frames. More recently, the Enhanced Coding Mode (ECM) has introduced a 6-tap filter, further improving the interpolation accuracy and visual quality of the encoded video. However, increasing the tap length can introduce challenges such as overshoot and ringing phenomena, particularly near discontinuity points in the signal, where abrupt changes occur.

[0047] Conversely, truncating the filter by reducing the tap length can yield several advantages, including lower computational complexity and reduced circuit design complexity, making the implementation more efficient. The performance degradation resulting from truncation is often limited, allowing for a balance between efficiency and effectiveness. While Lagrange filters have been effectively utilized for fractional direction interpolation in video coding, the application of truncated filters remains an unexplored area, presenting an opportunity for further research and development.

[0048] For more detailed information, please refer to “Fractional Delay Filter Design Based on Truncated Lagrange Interpolation, V. Valimaki and A. Haghparast, IEEE Signal Processing Letters, vol. 14, no. 11, pp. 816-819, Nov. 2007, doi: 10.1109 / LSP. 2007.898856” . ● Existing filter selection / adaptation method

[0049] Selecting the appropriate interpolation filters based on motion information and other criteria may enhance video coding efficiency. This technique allows for the optimal choice of interpolation filters from a subset, which can be dynamically determined based on various factors such as motion estimation, coding level, and prediction mode. The primary aim of this adaptability is to improve the quality of video encoding while managing complexity and signaling overhead.

[0050] The criteria for filter selection can encompass the coding level, prediction mode, and other coding tools in use. This can result in different subsets of filters being considered for different scenarios.

[0051] The coding level refers to the hierarchical structure of video encoding, which can include various levels such as sequence level, picture level, slice level, coding tree unit level, coding unit level, and transform unit level. The choice of filters can vary depending on the specific coding level being processed. For instance, certain filters may be more effective for coding units with high levels of detail, while others may be better suited for units with less detail. This adaptability allows the encoder to optimize performance based on the characteristics of the video content at different levels of granularity.

[0052] The Enhanced Compression Mode (ECM) employs the Mode-Dependent Intra Smoothing (MDIS) filter [1, 2, 1]  / 4 to refine intra reference samples based on specific conditions. This necessitates storing both unfiltered and filtered lines of intra reference samples for intra prediction. For directional intra modes, side reference samples are projected and extended to the main reference sample line. Subsequently, linear interpolation is applied to the reference sample line in cases of fractional pixel prediction for directional modes.

[0053] One proposal suggested replacing linear interpolation with a combination of Lagrange and Gaussian interpolation filters to significantly improve compression efficiency. These filters could be applied to either unfiltered or filtered reference samples, depending on separate interpolation filtering conditions. Applying Gaussian interpolation filtering on top of MDIS-filtered reference samples introduces two consecutive smoothing filtering operations, increasing complexity and requiring storage for both unfiltered and filtered intra reference sample lines.

[0054] To address this issue, an algorithm was proposed that disables MDIS filtering and MDIS conditions by convolving the MDIS filter [1, 2, 1]  / 4 with the 4-tap Gaussian interpolation filter from VVC, resulting in a 6-tap Gaussian interpolation filter. This approach eliminates the two-step smoothing filtering problem, but the [1, 2, 1]  / 4 filter is still applied for non-fractional prediction of samples. The algorithm determines which interpolation filter to use by comparing the block width (for vertical modes) or the block height (for horizontal modes) against a fixed threshold value of 8. By combining the MDIS filter with the Gaussian filter, the MDIS filtering before the extension of the main reference line is also avoided, which was proposed separately by switching the order of projection and MDIS filtering.

[0055] The Enhanced Compression Mode (ECM) proposes merging the two smoothing filtering operations for intra prediction of directional modes: MDIS filtering and Gaussian interpolation filtering. This approach differs from previous proposals by utilizing MDIS conditions to directly select between the two interpolation filters, eliminating the need for separate interpolation filter decisions. As a result, only the unfiltered reference sample line needs to be stored for MDIS, reducing line memory requirements. Additionally, the [1, 2, 1]  / 4 filtering for non-fractional sample prediction is avoided by employing zero-phase interpolation filter taps.

[0056] In the current design of interpolation filters, several challenges emerge when balancing computational complexity, precision, tap length, and coefficient pruning strategies. First, the increasing length of taps in high-precision filters raises the computational burden, especially for hardware implementations. Second, small coefficients near the edges of the filter often have negligible impact on interpolation accuracy but contribute disproportionately to complexity. Third, traditional pruning strategies lack adaptiveness, often leading to suboptimal precision-complexity trade-offs. These issues highlight the need for an optimized approach that maintains precision while reducing computational overhead. Below is an introduction to several challenges for the current design of interpolation filters.

[0057] 1) Computational overhead and Design complexity

[0058] Longer tap filters, while beneficial for achieving higher precision in interpolation, introduce significant computational overhead due to the increased number of arithmetic operations required for their implementation. This complexity can be particularly problematic in resource-constrained environments, such as video coding hardware, where processing power, memory and transistor of processing chip are limited. Each additional tap in the filter design necessitates more multiplications and additions, which can lead to longer processing times and increased power consumption. As a result, the efficiency of the encoding process may be compromised, making it essential to explore alternative filter designs that maintain acceptable performance while reducing computational demands.

[0059] 2) Edge Coefficient Contribution

[0060] In many filter designs, edge coefficients-those located at the beginning and end of the coefficient vector-often hold values that are close to zero. While these coefficients contribute minimally to the overall interpolation accuracy, they nonetheless increase the complexity of the filter. This can lead to unnecessary computational burden without a corresponding benefit in performance. Trimming or truncating these edge coefficients can be an effective strategy to simplify the filter design; however, it requires a careful approach to ensure that the quality of interpolation is not significantly compromised. A well-considered strategy for coefficient trimming should focus on maintaining the integrity of the filter's response while reducing its complexity, thereby achieving a balance between efficiency and performance.

[0061] 3) Unclear truncation for video coding related implementation

[0062] Unclear truncation for video coding related implementation means that the filter may not be optimally tailored to the specific characteristics of the signal being processed or the constraints of the hardware environment. For instance, in scenarios where high precision is required, a static truncating approach may inadvertently eliminate coefficients that are essential for maintaining quality, while in less demanding applications, it may retain unnecessary coefficients that increase computational load. To address this issue, the development of adaptive pruning strategies that dynamically adjust the coefficient set based on real-time analysis of the signal characteristics and performance metrics could significantly enhance filter efficiency and effectiveness. Such adaptive methods would allow for a more nuanced approach to coefficient selection, ensuring that the filter remains both performant and resource-efficient across a range of applications.

[0063] The present disclosure introduces a filter coefficient update mechanism, which may solve one or more or the above listed issues. This approach may be helpful for balancing computational efficiency and interpolation accuracy.

[0064] FIG. 2 is a flowchart of a decoding method applying filter coefficient update according to an embodiment of the present disclosure. As shown in FIG. 2, the method includes operations described in blocks S101 to S104.

[0065] In S101, reference samples for a prediction mode are determined.

[0066] Reference samples are specific pixels or values obtained from previously processed blocks or areas within the same video frame, or from other reference frames. These samples form the foundation for predicting the pixel values of the block currently being processed. This predictive process is governed by what is known as the prediction mode, which is essentially the algorithm or method utilized to estimate the pixel values of the current block by leveraging the reference samples.

[0067] There exists a variety of prediction modes, each designed to optimally handle different types of image or video content. The application of reference sample filtering can be effectively applied to various coding modes, including, but not limited to, angular intra prediction in ECM (such as Template-based Intra Mode Derivation (TIMD) , Directional Intra Mode Derivation (DIMD) , and Template-based Multi-Reference Line (TMRL) ) . Moreover, this solution of reference sample filtering is not limited to a specific codec but is applicable to a range of video codecs, including AVS, AOM-AV1, among others.

[0068] The area from which the reference samples are acquired, and the specific samples chosen, may depend on the selected prediction mode. Each prediction mode has its criteria for selecting reference samples to optimize the prediction for the current block's specific characteristics.

[0069] Any existing methods for determination of reference samples and prediction modes may be applied in the present disclosure.

[0070] In S102, a prototype filter is determined.

[0071] The prototype filter may be any filter adopted by ECM. Coefficients located at middle part of the prototype filter may have relatively larger magnitude compared to coefficients located at edge part of the prototype filter. For example, the prototype filter may be a Lagrange Filter.

[0072] In the present embodiment, the prototype filter can be utilized in its initial form, meaning it is used without performing a rounding operation based on a norm number. Alternatively, the prototype filter can be applied specifically using either its integer part or its fractional part. Also, a phase component of a specific filter may be selected as the prototype filter.

[0073] In order to design a filter, taps or length of the filter shall be defined. The "taps" refers to the number of coefficients or distinct sample points used in the filter to process an input signal. A longer-tap filter uses more surrounding data points to compute its output, which usually results in smoother or more precise filtering compare to shorter-tap filter. Both filters aim to balance precision and computational complexity by adjusting the number of phases and tap coefficients.

[0074] Phase refers to the fractional distance between known sample points in interpolation or smoothing. The number of phases determines the granularity of interpolation or smoothing. More phases lead to finer interpolation but higher computational cost.

[0075] An N-tap filter which performs interpolation filtering or smoothing filtering is utilized as an example for illustrative purpose. Its filter coefficients may correspond to 32, 64, or 128 phases.

[0076] In an interpolation filter, the coefficients Ci for these N taps are generated as following method if only phase is considered. In one example, the coefficients Ci may different by the indicate different direction mode, for example:

[0077] The li (x) Lagrange interpolation filter that use N neighboring samples to calculate the interpolated value.

[0078] In the formula, i is the index of the current Lagrange basis polynomial, x is the current interpolation position, and xj are the positions of the j support points. In linterpolation (phase) , the phase represents each fractional position between x and x+1. For example, for 32 phases,  for 64 phases,  for 128 phases,

[0079] For example, in a prototype 10-tap Lagrange filter, 10 neighboring samples are used to calculate the interpolated value. The coefficients for these 10 taps are pre-determined based on the relative position of the sample. Let: 1) C (p, i) be the filter coefficient for phase p at position i, where i=0~9 are the positions of the neighboring samples; 2) s [i] be the neighboring samples around the current position. The interpolated value y at a fractional position corresponding to phase can be expressed as:

[0080] This formula means that for each phase p, a different set of 10 coefficients C (p, i) ∈f (p, 0) , f (p, 1) , . . ., f (p, 9) is applied to the neighboring samples s [0] , s [1] , . . ., s [9] to compute the interpolated value.

[0081] A normalization operation (or called coefficients rounding) may be performed for coefficients of the filter. The choice of norms determines the precision and range of the coefficients, enabling a balance between computational complexity and numerical accuracy. The following method may involve in the determination of norms. Where C (p, i) is the fractional part of the filter coefficient, Cint is the integer part of the filter coefficient, and NN is the norm number. Cint=round (C (p, i) *NN)

[0082] The process is further explained as follows.

[0083] a) Coefficients in initial form

[0084] The initial prototype filter coefficients C (p, i) may be in the range [-1≤C (p, i) ≤1] , represented in fractional form (e.g., floating-point values) .

[0085] b) Normalize Coefficients to Integer Form

[0086] After rounding, the coefficients are scaled to the required norm NN (e.g., NN=64, 256, or 8192) , which ensures integer compatibility:

[0087] In the formula,  denotes the ceiling function,  denotes the floor function and T is a threshold which is a real number. For example, T can be a pre-defined value 0.5.

[0088] The result Crounded [i] is now an integer representation of the coefficients with the desired norm. Then, an adjustment value may be calculated as:

[0089] If Valueadjust equal to zero, then the generated prototype satisfies the design requirements. Otherwise, an adjustment on coefficients may be performed. The process for adjustment of coefficients of the prototype filter is explained below.

[0090] The fractional component of Cfrac [i] can be extracted as: Cfrac [i] =Crounded [i] -Ci [i] *NN

[0091] The loss to per position may be acquired. Specifically, a weighting factor WF to the fractional part to emphasize its importance before rounding per coefficient position:

[0092] Alternatively, the loss to overall importance may be acquired. A weighting factor WF to the fractional part to emphasize its importance before rounding in overall coefficients may be determined as:

[0093] With the weighting factor acquired with either of the above methods, the coefficient adjustment may be performed.

[0094] In a first option, the coefficient weight factor W (i, F) is sorted in descending / ascending order. The weighted coefficients CweightAdjusted [i] are then adjusted based on the coefficient WF importance. Firstly, all W (i, F) are sorted in descending / ascending order. Secondly, from the sorted list, apply a value of +1 or -1 (according to the sign of the adjustment value) to the corresponding position i. Then, re-do adjustment for each coefficient until:

[0095] In a second option, the coefficient weight factor W (i, F) is sorted in descending / ascending order by sign group (i.e., those having the same sign are in the same group) . The weighted coefficients CweightAdjusted [i] are then adjusted based on the coefficient WF importance. Firstly, all W (i, F) are sorted in descending / ascending order with groups divided based on their sign (+ / -) . Secondly, within the sorted list for the (+) group, apply a value of +1 to the corresponding position i, and within the sorted list for the (-) group, apply a value of -1 to the corresponding position i. Then, re-do adjustment for each coefficient until:

[0096] In a third option, the taps of the prototype filter are divided into groups based on position or weight (e.g., left, right part of the coefficients) . A first level adjustment is performed within each group, which is similar to the steps in the first or second option, and includes: sorting W (i, F) in descending / ascending order or sign group; within the sorted list, applying a value of +1 or -1 to the corresponding position i; and re-doing adjustment for each coefficient until:

[0097] Then a second-level adjustment is performed across groups (e.g., both left and right) to balance total error.

[0098] In a fourth option, the step size for coefficient adjustment may be dynamically adjusted. Larger step sizes may be allowed for significant errors, while finer adjustments are used for smaller errors. For example, with a given threshold NTapLength, if Valueadjust>NTapLength, the step size is dynamically adjusted based on error magnitude. Firstly, all W (i, F) are sorted in descending / ascending order and / or with groups divided based on their sign (+ / -) . Secondly, within the sorted list, applying a value of +K or –K to the corresponding position I, where K may be a value derived from sorted W (i, F) of overall norm difference Valueadjust:

[0099] For W (i, F) with top order and Krounded<1 , the value of K is set equal to 1. Re-do adjustment for each coefficient until:

[0100] The above formula also may serve as a standard for constraint check, which ensures the sum of the normalized coefficients matches the target norm NN.

[0101] Below is provided the 15 / 32 position integer coefficients of an exemplary 10-taps prototype interpolation filter with 32 phase design.

[0102] The prototype filter utilized in subsequent operations may be of its initial form, its integer form, its fractional form, or any form of one of its phase component, which is not limited in the present disclosure.

[0103] The foregoing provides introduction about processing an initial prototype filter. However, it should be noticed that, in some embodiments, the decoder may pre-store multiple prototype filters (in any form) , and the decoder may acquire the required prototype filter directly based on, for example, the prediction mode or an instruction from the encoder without the foregoing process.

[0104] In S103, an updated filter is acquired based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter.

[0105] The updated filter may be acquired by trimming the coefficients of the prototype filter. Alternatively, the updated filter may be acquired by truncating the coefficients of the prototype filter. Alternatively, the updated filter may be acquired by firstly truncating the coefficients of the prototype filter and the trimming the truncated coefficients.

[0106] The trimming operation refers to setting some coefficients of the filter to low values. The truncating operation refers to discarding some coefficients of the filter. Detailed explanation for the two kinds of operations will be given below.

[0107] The first way for acquiring the updated filter is trimming the low weight coefficient. In general, the coefficient near the edge always has a low weight (magnitude) , it makes a low contribution to the functional increased but occupy same computation resources as the high weight coefficient.

[0108] In some embodiments, the operation of trimming one or more coefficients of the prototype filter comprises: determining a trimming length K, wherein K is a positive integer; and setting values of first K coefficients and / or last K coefficients of the prototype filter to zero; setting values of first K coefficients and / or last K coefficients of the prototype filter to positive one or negative one.

[0109] Taking a filter of integer form with N taps as an example, trimming K taps at each outmost edge is represented as: where Cint [i] is the integer form coefficient at position i, N is the amount of coefficients of the filter.

[0110] The trimmed value is designed to let these position to maintain low involving in the filtering. For example, valuetrimmed may set to zero, +1 or -1, which may depend on the current coefficients (the coefficients before trimming) sign.

[0111] After trimming, the untouched coefficients are located in the range: i∈ {K, K+1, …, N-K-1}

[0112] One way for determining the trimming length K may include: acquiring a target tap length of the updated filter; and determining the trimming length K based on the target tap length of the updated filter and a tap length of the prototype filter.

[0113] In this method, the trimming length K is derived from the difference from the tap length of the prototype filter and the tap length of the target trimmed filter: K=(TapLengthoriginal-TapLengthtarget)  / 2

[0114] The target tap length may be pre-defined at the decoder. Alternatively, the target tap length may be determined based on other conditions such as the prediction mode, the number of reference samples for filter etc.

[0115] Another way for determining the trimming length K may include: acquiring a magnitude threshold; determining a first position before which absolute values of coefficients of the prototype filter are less than the magnitude threshold; or determining a second position after which absolute values of coefficients of the prototype filter are less than the magnitude threshold; and determining the trimming length K based on the first position or the second position.

[0116] In this method, the trimming length K is derived from a predefined threshold. For example, for a position with value for each phase less than 3, the coefficient value will be trimmed.

[0117] For multiple positions where the value exceeds a certain threshold, and there is a max position in the total phase, the position 'i'of that particular coefficient with the max position is noted. This position is then used for calculating the trimming length K. The following is an exemplary 10-taps filter:

[0118] Assuming the predefined threshold is “8” , then the max position where the coefficient value is larger than the threshold is the position “7” . Then the trimming length may be determined as k=9-7=2. In this way, those coefficients with values lower than the predefined threshold may be trimmed.

[0119] In some embodiments, the operation of trimming one or more coefficients of the prototype filter comprises: acquiring a target tap number M, wherein M is a positive integer; keeping M coefficients located at middle of the prototype filter; and trimming other coefficients of the prototype filter to a target value.

[0120] Taking a filter of integer form with N taps as an example, keeping inner M taps at center is represented as: where Cint [i] is the integer form coefficient at position i, N is the amount of coefficients of the filter,  and M is the target tap number.

[0121] In other words, each coefficient is accumulated from inner side of prototype filter coefficients, until it covered target Tap number M:

[0122] In some embodiments, the operation of trimming one or more coefficients of the prototype filter comprises: acquiring a value threshold T; keeping a plurality of coefficients located at middle of the prototype filter of which a sum is no less than a product of the value threshold and a total value of the prototype filter; and trimming other coefficients of the prototype filter to a target value.

[0123] In other words, each coefficient is accumulated from inner side of prototype filter coefficients, until the value reached a threshold:

[0124] The threshold T may be a predefined value. For example, T=0.95 means once Valueaccumulated reaches 95%of sum of overall coefficients values (total value) , the rest coefficients can be trimmed to a target value.

[0125] The target value mentioned in foregoing methods may refer to a predefined value, which is relatively low. For example, the target value may be 0, +1, or -1.

[0126] For better illustrating the trimming process, an example is given below. For example, when the prototype filter is designed with tap length equal to 8 and the target trimmed filter length is equal to 6, then the trimming length K is 1. Coefficients of the exemplary prototype filter may be as follow:

[0127] After performing the trimming operation:  coefficients of the updated filter may be as follow:

[0128] The second way for acquiring the updated filter is truncating the filter, that is, modifying a longer tap filter into a shorter tap filter.

[0129] In the filter coefficients truncating process, higher weighted coefficients are re-arranged to a shorter-tap filter coefficients set. This step can be generalized to truncating multiple taps at designed position, depending on the application requirements or frequency response performance.

[0130] For a prototype filter or a trimmed filter, let the filter coefficients be: CP= [c0, c1, c2, …cn] , where ci∈real number

[0131] The goal is to truncate the coefficients, one method is reducing the number of coefficients from N (longer tap) to M (shorter tap) , where M<N, while preserving critical properties such as prediction accuracy and sum constraint.

[0132] In one embodiment, the operation of truncating one or more coefficients of the normalized integer form of the prototype filter may include: determining a truncating threshold; removing coefficients of the prototype filter whose values are less than the truncating threshold.

[0133] Specifically, a truncating threshold τ may be determined (e.g., pre-defined or received from a bitstream transmitted from an encoder) . Coefficients of the prototype filter with less significant magnitude or contribution than the truncating threshold may be truncated (i.e., removed / discarded) . The value τ could be predefined constant value or a performance requested value. Then the retained M coefficients would be: Ctruncated= [c′0, c′1, c′2, …, c′M] , c′j∈CP, c′j≥τ

[0134] Taking a filter of integer form with N taps as an example, keeping inner M taps at center is represented as:

[0135] In another embodiment, a truncating length may be utilized for the truncating operation. Determination and utilization of the truncating length may be similar to that of the trimming length as mentioned above, and will not be repeated herein.

[0136] For better illustrating the truncating process, an example is given below. For example, when the prototype filter is designed with tap length equal to 8 and the target truncated filter length is equal to 6, then the truncating length K is 1. Coefficients of the exemplary prototype filter may be as follow:

[0137] After performing the trimming operation: Ctruncated [i] = [c1, c2, c3, c4, c5, c6] , coefficients of the updated filter may be as follow:

[0138] In S104, the reference samples are filtered with the updated filter to generate predicted samples of a current block.

[0139] With the updated filter, the reference samples may be processed to directly or indirectly generate predicted samples of a current block. This process may be similar to any filtering process involved in existing intra or inter prediction modes, and will not be elaborated herein.

[0140] Based on the present disclosure, coefficients of a prototype filter may be trimmed or truncated to acquire an updated filter, and the updated filter may be utilized for sample prediction. The implementation of the method may reduce influence of low weight coefficient in the filtering process, which may bring lower computational complexity and thus improve the coding performance.

[0141] FIG. 3 is a flowchart of a decoding method applying filter coefficient update according to another embodiment of the present disclosure. As shown in FIG. 3, the method may include operations described in blocks S201 to S206.

[0142] In S201, reference samples for a prediction mode are determined.

[0143] In S202, a prototype filter is determined.

[0144] In S203, an updated filter is acquired based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter.

[0145] The operations S201 to S203 are similar to the operations S101 to S103, and will not be elaborated herein.

[0146] In this embodiment, coefficients of the updated filter may be normalized. Specifically, if ∑iCtrimmed [i] does not equal to norm number NN, then a coefficient adjustment is requested. Alternatively, if ∑iCtruncated [i] does not equal to norm number NN, then a coefficient adjustment is requested.

[0147] The coefficient adjustment may be achieved by either performing operations described in blocks S2041 and S2042, or performing operations described in block S205.

[0148] In S2041, a coefficient adjustment value is calculated.

[0149] In S2042, the coefficients of the updated filter are adjusted based on the coefficient adjustment value.

[0150] The prototype filter for generating the updated filter may be of its normalized integer form. In other words, the operation of trimming and / or truncating one or more coefficients of the prototype filter may include: trimming and / or truncating one or more coefficients of a normalized integer form of the prototype filter. The normalized integer form of the prototype filter has a corresponding norm number, denoted as NN.

[0151] The coefficient adjustment value may be calculated based on a difference between sum of coefficients of the updated filter and the norm number NN, that is:

[0152] The acquired coefficient adjustment value may then be utilized for adjusting the coefficients of the updated filter.

[0153] The operation of adjusting the coefficients of the updated filter based on the coefficient adjustment value may include: determining weights of the coefficients of the updated filter; and adjusting the coefficients of the updated filter based on the weights and the coefficient adjustment value.

[0154] Specifically, a weight of a coefficient of the updated filter is determined based on: a difference between the coefficient and a product of a corresponding coefficient of the integer form of the prototype filter and the norm number; and the product of the corresponding coefficient of the integer form of the prototype filter and the norm number.

[0155] The fractional component Cfrac [i] of the updated filter acquired by trimming can be extracted as: Cfrac [i] =Ctrimmed [i] -Ci [i] *NN where Ctrimmed [i] is the i-th coefficient of the updated filter acquired by trimming, Ci [i] *NN is the  normalized integer coefficient of the prototype filter.

[0156] Similarly, the fractional component Cfrac [i] of the updated filter acquired by truncating can be extracted as: Cfrac [i] =Ctruncated [i] -Ci [i] *NN where Ctrimmed [i] is the i-th coefficient of the updated filter acquired by truncating.

[0157] One way to acquire weights for coefficients of the updated filter is pre-positioning weight method. Specifically, a weighting factor W (i, F) for the i-th coefficient of the updated filter which is associated to the fractional part for representing its importance before rounding for per coefficient position may be calculated as:

[0158] Another way to acquire weights for coefficients of the updated filter is loss to overall importance method. Specifically, a weighting factor W (i, F) for the i-th coefficient of the updated filter which is associated to the fractional part for representing its importance before rounding in overall coefficients may be calculated as:

[0159] The operation of adjusting the coefficients of the updated filter based on the weights and the coefficient adjustment value may include, but is not limited to, any one of the following: 1) evenly distributing the coefficient adjustment value to coefficients of the updated filter with largest weights; 2) evenly distributing the coefficient adjustment value to coefficients of the updated filter with largest weights and a same sign as the coefficient adjustment value; 3) evenly distributing one half of the coefficient adjustment value to coefficients of a first half of the updated filter with largest weights, and distributing another half of the coefficient adjustment value to coefficients of a second half of the updated filter, positions of which correspond to the coefficients of the first half of the updated filter; or 4) dynamically distributing the coefficient adjustment value to coefficients of the updated filter with largest weights. Detailed explanation is given below.

[0160] In a first option, the coefficient weight factor W (i, F) is sorted in descending / ascending order. The weighted coefficients CweightAdjusted [i] are then adjusted based on the coefficient WF importance. Firstly, all W (i, F) are sorted in descending / ascending order. Secondly, from the sorted list, apply a value of +1 or -1 (according to the sign of the adjustment value) to the corresponding position i. Then, re-do adjustment for each coefficient until:

[0161] In a second option, the coefficient weight factor W (i, F) is sorted in descending / ascending order by sign group (i.e., those having the same sign are in the same group) . The weighted coefficients CweightAdjusted [i] are then adjusted based on the coefficient WF importance. Firstly, all W (i, F) are sorted in descending / ascending order with groups divided based on their sign (+ / -) . Secondly, within the sorted list for the (+) group, apply a value of +1 to the corresponding position i, and within the sorted list for the (-) group, apply a value of -1 to the corresponding position i. Then, re-do adjustment for each coefficient until:

[0162] In a third option, the taps of the prototype filter are divided into groups based on position or weight (e.g., left, right part of the coefficients) . A first level adjustment is performed within each group, which is similar to the steps in the first or second option, and includes: sorting W (i, F) in descending / ascending order or sign group; within the sorted list, applying a value of +1 or -1 to the corresponding position i; and re-doing adjustment for each coefficient until:

[0163] Then a second-level adjustment is performed across groups (e.g., both left and right) to balance total error.

[0164] In a fourth option, the step size for coefficient adjustment may be dynamically adjusted. Larger step sizes may be allowed for significant errors, while finer adjustments are used for smaller errors. For example, with a given threshold NTapLength, if Valueadjust>NTapLength , the step size is dynamically adjusted based on error magnitude. Firstly, all W (i, F) are sorted in descending / ascending order and / or with groups divided based on their sign (+ / -) . Secondly, within the sorted list, applying a value of +K or –K to the corresponding position I, where K may be a value derived from sorted W (i, F) of overall norm difference Valueadjust:

[0165] For W (i, F) with top order and Krounded<1 , the value of K is set equal to 1. Re-do adjustment for each coefficient until:

[0166] The above formula also may serve as a standard for constraint check, which ensures the sum of the normalized coefficients of the updated filter matches the target norm NN.

[0167] In some embodiments, artificial intelligence (AI) or machine learning (ML) methods can be utilized for weight determination and adjustment of coefficients of the updated filter. Specifically, the operation of adjusting the coefficients of the updated filter based on the weights and the coefficient adjustment value may include: distributing the coefficient adjustment value to coefficients of the updated filter proportionally to the weights of the coefficients of the updated filter. Accordingly, the operation of determining the weights of the coefficients of the updated filter may include: determining optimal weights of the coefficients of the updated filter by minimizing a difference between original samples and predicted samples which are generated by applying the updated filter with the weights of the coefficients to reference samples of the original samples. Detailed explanation is give below.

[0168] The coefficients can be adjusted based on a set of learned weights, rather than rule-based designed adjustment methods. Specifically, given a set of rounded coefficients after truncation and normalization as Ctruncated= [c′0, c′1, c′2, …, c′M] , a set of weights {wi} i=0, ..., M is employed, each wi indicating the relative importance of a corresponding coefficient c′i, and the weights may satisfy that:

[0169] To meet the sum constraint Norm, an adjustment amount Δ is calculated as and then distributed to different weight elements. In one example, the amount is distributed proportionally as Δi=wi·Δ. In another example, the amount is distributed to weight elements with the maximum value (or the top maximum value (s) , the value (s) exceeding a specific threshold) proportionally (or evenly) .

[0170] The adjusted coefficient is derived as addition of 1) original coefficient and 2) the rounding result of Δi to its nearest integer, which can be expressed as: c′i=ci+round (Δi) .

[0171] Weights can be learned using an optimization algorithm (e.g., gradient descent and backpropagation) . The optimization goal is to find the optimal wi that has the minimize difference between the original sample and the interpolated result of filter using the adjusted coefficients, which can be expressed as:

[0172] In the formula, sorg denotes an original sample, sref [i] denotes the i-th reference sample, and denotes an error metric, e.g., absolute error, squared error.

[0173] Typically, important filter coefficients may be located at different tap positions at different phases. Therefore, one or more sets of corresponding learned weights may be configured corresponding for each phase.

[0174] In one case, one or more sets of learned weights are configured corresponding to each tap length of prototype filters. For example, learned weights are configured for 16, 14, 12, 10, and 8-tap that will be truncated to 6-tap uniformly, respectively.

[0175] In another case, one or more sets of learned weights are configured corresponding to each tap length after trimming. For example, learned weights are configured for a trimming of a given 16-tap filter into 14, 12, 10, 8, and 6-tap, respectively.

[0176] Based on coding condition, the learned weights can be configured in an offline or online manner.

[0177] As for offline adjustment, the learned weights are trained offline (e.g., using benchmark training database) and then pre-configured at both encoder and decoder sides. For example, during encoding / decoding process, a corresponding set of weights is derived from a look-up table, based on a trimmed filter to be adjusted (or a prototype filter to be trimmed) , with / without relevant information (e.g., contextual information from neighboring blocks or templates) .

[0178] As for online adjustment, the learned weights are trained online and then signaled from encoder to decoder side for content adaptation. For example, during encoding process, a set of weights is trained per block  / frame  / sequence. These trained weights are applied to obtain adjusted coefficients for encoding, and are also multiplexed into stream. During decoding process, these trained weights are demultiplexed and applied to obtain adjusted coefficients for correct decoding.

[0179] In S205, the coefficients of the updated filter are adjusted by adding values of the coefficients of the prototype filter that are trimmed or truncated to the coefficients of the updated filter.

[0180] This method provides another way for compensating the loss caused by the trimming or truncating operation. This adjustment involves adding the values of the coefficients from the prototype filter that were previously reduced (either trimmed or truncated) to the coefficients of the updated filter. The rationale behind this step is to compensate for the reduction in the total value of the coefficients that occurred during the trimming or truncating process. By doing so, it aims to achieve a form of normalization or restoration of the filter's overall response characteristics. For example, the values lost due to trimming or truncating could be added to the coefficients of the updated filter that are closest to the positions where the trimming or truncating took place.

[0181] In one option, for Cint [i] set to zero, an offset is recorded. This offset is added to the neighboring position. The following table shows an example:

[0182] The value of position 0 and 7 is offset to the neighboring position 1 and 6.

[0183] In another option, for Cint [i] set to zero, an offset is recorded. This offset is added to the nearest coefficient position with the same sign. The following table shows an example:

[0184] The value of position 0 and 7 is offset to the nearest neighboring position with same sign 2 and 5.

[0185] In S206, the reference samples are filtered with the updated filter to generate predicted samples of a current block.

[0186] Similar to the operation S104, with the updated filter, the reference samples may be processed to directly or indirectly generate predicted samples of a current block. This process may be similar to any filtering process involved in existing intra or inter prediction modes, and will not be elaborated herein.

[0187] Moreover, the filter coefficient update method described with regard to either FIG. 2 or FIG. 3 may be combined with a filter selection method.

[0188] (1) Conditional selection based on prediction mode and / or geometrical condition

[0189] In one embodiment, the operation of determining the prototype filter described in S102 or S202 may include: acquiring a plurality of candidate filters; determining the prototype filter from the plurality of candidate filters based on a prediction angle of the prediction mode and / or a size of the current block.

[0190] The filter selection method may be based on prediction mode, prediction angular and / or block geometric property (size: width, height; aspect ratio; and etc. ) . Conditional selection based on following check result may be applied.

[0191] Firstly, two conditions may be tested, which aims to fit the filters with their best performance scenario. The selection may be based on bother of these two conditions, or only one of these two conditions. One condition is the angular value difference conditionang. The conditionang verify the comparison ValueD between current prediction angle and the predefined horizontal angle; and / or the comparison value between current prediction angle and the predefined vertical angle, with a difference threshold ThresholdD . Another condition is the geometrical conditiongeo . The conditiongeo verifies the comparison between current block geometric ValueG and geometric threshold ThresholdG.

[0192] In the formula, filterA, and filterB are filter elements in a predefined filter set (candidate filters) . The filter set may include filters with different phase, coefficients norm or tap length design. For example,

[0193] In the tested conditions, comparison ValueD would be the angular value difference, angular mode index difference, current block geometric information infogeo etc. Comparing the difference with a given threshold ThresholdD can be utilized to determine which filter would be used for current block. conditionang=ValueD>ThresholdD ValueD=f (prediction angular, horizontal angular, vertical angular, …, infogeo)

[0194] Value involved in the differential comparison could include current prediction angular value or corresponding index, pre-defined horizontal angle, vertical angular value or its index and current block geometric information infogeo . Comparison of the geometrical properties with a given threshold ThresholdG could be used to determined which filter can be used for current block with geometric restriction. For example, conditiongeo=ValueG<ThresholdG ValueG=f (width, height, infogeo)

[0195] The current block geometric information infogeo may refer to width, height, split depth, and etc.

[0196] For determining the comparison ValueD, the following process may be adopted.

[0197] Prediction angular mode index difference ValueD could be computed as following orders. ValueD =f(prediction angular, horizontal angular, vertical angular, statusE, …, infogeo)

[0198] a) The derivation may include prediction angular , horizontal angular , vertical angular , extra intra prediction direction mode statusE , and the split depthsplit of the current block. Wherein one example, the prediction angular, horizontal angular, and vertical angular may be replaced by the representation of IndexPred Ang, indexHor Ang and indexVer Ang. ValueD=f (IndexPred Ang, indexHor Ang, indexVer Ang, statusE)

[0199] b) The indexHor Ang and indexVer Ang are the predefined horizontal index and vertical index. Due to the IndexPred Ang may appear in the middle of indexHor Ang and indexVer Ang, a minimum selection is needed in the calculation. ValueD=minimum (differenceH, differenceV)

[0200] c) The differenceH, differenceV here represents the absolute difference between two index value as follow. differenceH=abs (IndexPred Ang-indexHor Ang) differenceV=abs (IndexPred Ang-indexVer Ang)

[0201] d) The predefined horizontal angular mode indexHor Ang and vertical mode indexVer Ang value may differ, if there is multiple indexing mode for intra prediction angle. Thus, a selection for predefined value between multiple mode is needed.

[0202] For example, in JVET ECM extra intra prediction direction mode statusE is used to identify the indexing mode. It can select the horizontal angular mode indexHor Ang and vertical mode indexVer Ang base on the value of extra intra prediction mode statusE.

[0203] For determining the ThresholdD, the following process may be adopted. The computation of adaptive prediction angular value difference ThresholdD with geometric information could be processed as following orders.

[0204] a) The derivation of ThresholdD is based on the current block width / height valuew, valueh, split depthsplit of the current block and extra intra prediction direction mode StatusE. ThresholdD=f (valuew, valueh, depthsplit, StatusE)

[0205] b) The adaptive ThresholdD may differ, if there is multiple indexing mode for intra prediction angle. Thus, a selection for ThresholdD between multiple mode StatusE is needed.

[0206] c) The ValueE represent the threshold for extra intra prediction mode and ValueN represent the threshold for non-extra intra prediction mode. And the ValueN may differ with ValueE with a ratio parameter k.

[0207] d) The ValueE is a representation of geometric information, such as, area of the block, ratio of the block width / height.

[0208] e) In one example, the ValueE could be geometrical log2 represent value log2size.

[0209] In an implementation, it may use k=2 as an adjust ratio for ValueN, then ThresholdD is defined as follow.

[0210] f) In one example, a fixed prediction angular mode index difference could be defined.

[0211] For determining the ThresholdG, the following process may be adopted. Representative Block geometric ThresholdG with geometric information could be processed as following orders.

[0212] a) The derivation of ThresholdG is based on the current block width / height valuew , valueh, split depthsplit of the current block, and extra intra prediction direction mode StatusE. ThresholdG=f (valuew, valueh, depthsplit, StatusE)

[0213] b) The adaptive ThresholdG may differ, if there is multiple indexing mode for intra prediction angle. Thus, a selection for ThresholdG between multiple mode StatusE is needed.

[0214] c) In one example, a log2 representation of geometric threshold could be define. Then, the ThresholdG is defined as follow.

[0215] d) In one example, a width / height geometric threshold could be processed as following orders.

[0216] e) In one example, current block geometric area threshold could be processed as following orders.

[0217] f) In one example, geometric block width / height or height / width ratio threshold could be processed as following orders.

[0218] For the final determination of filteradap, the following process may be adopted.

[0219] In a first option, the determination of adaptive prediction angular ValueD and its ThresholdD with geometric restriction ThresholdG.

[0220] a) For a coding frames with coding blocks may have two different phase conditions, filteradap is a selected by the extra intra prediction direction mode StatusE.

[0221] b) filter32p, and filter64p are filter elements in a redefined filter set. For example,

[0222] c) The determination of filter32p is as follow, and the determination of filter64p follows the same method.

[0223] d) In one example, ValueD uses computation method option#1 and adaptive prediction angular value difference ThresholdD , with a log2 representation of geometric ThresholdG . The implementation for filter64p may look like, ValueD=minimum (abs (IndexPred Ang-indexHor Ang) , abs (IndexPred Ang-indexVer Ang) )

[0224] In a second option, adaptive prediction angular value difference threshold with geometric width / height ratio information.

[0225] a) For a coding frames with coding blocks may have two different phase conditions, filteradap is a selected by the extra intra prediction direction mode StatusE.

[0226] b) The determination of filter32p is as follow, and the determination of filter64p follows the same method.

[0227] c) The value sidepred ang is derived to indicate whether the prediction angle pointing to the longer side of the current block. Where absolute difference to horizontal index as differenceH and absolute difference to horizontal index as differenceV.

[0228] (2) Filter selection based on Template matching cost

[0229] In another embodiment, the operation of determining the prototype filter described in S102 or S202 may include: acquiring a plurality of candidate filters; determining the prototype filter from the plurality of candidate filters based on template matching costs of the plurality of candidate filters in a template area of the current block.

[0230] This method leverages template matching to dynamically select the most suitable interpolation filter based on the characteristics of the current block and its relationship to reference samples. By calculating the matching cost for various filters, the approach ensures that the selected filter provides the best possible prediction accuracy for pixel values, enhancing the overall performance of the interpolation process.

[0231] Firstly, the necessary input parameters are gathered. The necessary parameters include: current block dimensions, prediction angle, prediction mode, and reference samples.

[0232] a) Current Block Dimensions: Include the width and height to determine the size of the prediction block requiring interpolation.

[0233] b) Prediction Angle: Specify the angular direction or angle index of prediction.

[0234] c) Prediction Mode: Incorporate any extra intra prediction modes available in the codec.

[0235] d) Reference Samples: Utilize neighboring pixel values from adjacent blocks as a reference for template matching.

[0236] Then, a set of available interpolation filters are defined, which may include:

[0237] a) Legacy Filters: Include filters such as 4-tap, 6-tap, and 8-tap commonly used in video coding standards.

[0238] b) Customized filters including truncated filters and / or trimmed filters.

[0239] c) Filters with varying norms: Adaptable to specific precision requirements (e.g., norms 64, 256, …, 8192) .

[0240] Filter characteristics may include: a) Tap count: determine the granularity of interpolation; b) interpolation method: specify linear, cubic, or smoothing interpolation.

[0241] The filtered pixel values and the template matching cost may be calculated.

[0242] For each available filter, apply the filter to the reference sample in order generate filtered predicted pixel values. This involves: a) Convolution of the filter coefficients with the pixel values on the reference sample; b) Producing a set of filtered predicted pixel values for the current block based on the filter being applied.

[0243] For each set of predicted pixel values generated by the filters, calculate the template matching cost against the reference sample values. The cost can be computed using a similarity measure, such as:

[0244] a) Sum of Absolute Differences (SAD) : This method calculates the absolute difference between predicted and reference pixel values, providing a simple yet effective cost measure:

[0245] b) Mean Squared Error (MSE) : This method computes the average of the squares of the differences between predicted and reference pixel values: (fix this formula)

[0246] c) Normalized Cross-Correlation (NCC) : This method measures the similarity between predicted and reference pixel values by normalizing the cross-correlation:

[0247] The cost function can be defined as: where Pi is the predicted pixel value from the filter, and Ri is the corresponding reference sample  value.

[0248] After calculating the costs for all filters, sort the filters based on their respective costs in ascending order. The filter with the lowest cost indicates the best match to the reference sample.

[0249] Once costs are computed, the optimal filter can be determined and applied.

[0250] In a first option, the filter with the minimum cost may be selected, the index or identifier of the optimal filter may be stored.

[0251] In a second option, predefined conditions may be used to select the filter category (e.g., cubic filter, smoothing filter, DCTIF) . Then within the filter category, the filter with the minimum cost may be selected.

[0252] In a third option, the filter category (e.g., cubic filter, smoothing filter, DCTIF) may be selected based on group template matching cost. Then within the filter category, predefined condition may be used to select filter with different length.

[0253] The finally selected filter may be taken as the prototype filter.

[0254] The present disclosure also provides a scenario where the filter selection method may be adopted. Filter selection may be utilized for expanded reference sample preprocessing method based on pixel position, prediction mode, prediction angular and / or block geometric property, where the adaptive interpolation filter includes 4-tap, 6-tap, 8-tap, and / or N-tap (N>8) . The selection may be based on current block width, height and prediction angular, and extra intra prediction mode. The process is described as follows:

[0255] The process involves using the opposite angular direction to obtain extended samples. The specific implementation details align with existing methods, which are not elaborated on in this document. To summarize this step, the procedure utilizes the prediction angular value's direction to derive an opposite angular direction value.

[0256] Subsequently, this value is used to select the original data from the left reference line sample for the top reference line. This original data is then directionally copied to the farthest left side of the top reference line, as depicted in FIG. 4. Similarly, for the left reference line, the top reference line sample is selected as the original data and is directionally copied to the uppermost side of the left reference line.

[0257] The extended position's sample must be prepared according to the target filter length requested. It should be noted that longer filters require more samples to match the filter implementation length.

[0258] The process of extended sample filter adaptation is determined by the current block's prediction mode, prediction angle, and the length of the extended sample. The selection of the appropriate filter and its corresponding threshold is derived in a manner similar to the conditional filter selection method. This approach ensures that the filter adaptation is tailored to the specific requirements of the current block's characteristics and the extended sample's properties.

[0259] FIG. 5 is a flowchart of a decoding method applying filter coefficient update according to yet another embodiment of the present disclosure. As shown in FIG. 5, the method includes operations described in blocks S301 to S306.

[0260] In S301, reference samples for a prediction mode are determined.

[0261] In S302, a first prototype filter and a second prototype filter are determined.

[0262] In S303, a first updated filter is acquired by trimming and / or truncating one or more coefficients of the first prototype filter.

[0263] In S304, a second updated filter is acquired by trimming and / or truncating one or more coefficients of the second prototype filter.

[0264] In S305, a target filter is selected from the first updated filter and the second updated filter.

[0265] In S306, the reference samples are filtered with the target filter to generate predicted samples of a current block.

[0266] In some embodiments, the operation of selecting the target filter from the first updated filter and the second updated filter may include: selecting the target filter based on a prediction angle of the prediction mode and / or a size of the current block.

[0267] In some embodiments, the operation of selecting the target filter from the first updated filter and the second updated filter may include: selecting the target filter based on template matching costs of the first updated filter and the second updated filter in a template area of the current block.

[0268] Methods for acquiring the first updated filter based on the first prototype filter and for acquiring the second updated filter based on the second prototype filter may be similar to those described with regard to FIG. 2 and FIG. 3.

[0269] Methods for selecting the target filter from the first updated filter and the second updated filter may be similar to the filter selection methods described in foregoing sections of the present disclosure.

[0270] In this implementation, the candidate filters may include multiple trimmed or truncated filters, and the target filter may be selected from the candidate filters. The selected trimmed or truncated filter may have a better performance, and thus the prediction performance may be improved.

[0271] The present disclosure further provides an encoding method. FIG. 6 is a flowchart of an encoding method applying filter coefficient update according to an embodiment of the present disclosure. As shown in FIG. 6, the method includes operations described in blocks S401 to S404.

[0272] In S401, reference samples for a prediction mode are determined.

[0273] In S402, a prototype filter is determined.

[0274] In S403, an updated filter is acquired based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter.

[0275] In S404, the reference samples are filtered with the updated filter to generated predicted samples of a current block.

[0276] Optionally, after performing the filter coefficient update operation, the encoding device may transmit information relative to the filter coefficient update to a corresponding decoder via a bitstream. For example, the information may include: indication of the prototype filter, trimming length, target tap length, truncating length, magnitude threshold for determining the trimming length, etc.

[0277] Several exemplary trimmed or truncated filters are listed below for illustrative purpose.

[0278] The following interpolation filter with 8-tap design is generated from a selected 20-taps prototype filter, Table 1 shows its 32phases coefficients. Table 1

[0279] Table 2 shows its 64 phases coefficients. Table 2

[0280] The following interpolation filter with 6-tap design is generated from a selected 12-taps prototype filter, Table 3 shows its 32phases coefficients. Table 3

[0281] Table 4 shows its 64 phases coefficients. Table 4

[0282] The following interpolation filter with 8-tap design is generated from a selected 26-taps prototype filter, Table 5 shows its 32 phases coefficients. Table 5

[0283] Table 6 shows its 64 phases coefficients. Table 6

[0284] The following interpolation filter with 6-tap design is generated from a selected 18-taps prototype filter, Table 7 shows its 32 phases coefficients. Table 7

[0285] Table 8 shows its 64phases coefficients. Table 8

[0286] Implementation of the filter coefficient update mechanism introduced in the present disclosure several technical benefits, including at least one of: 1) reduced computational and design complexity; 2) improved precision-retention strategy; and 3) enhanced adaptiveness.

[0287] Specifically, the selective pruning of edge coefficients significantly decreases the number of arithmetic operations required for filter implementation, leading to lower computational complexity without compromising interpolation quality. By strategically identifying and removing coefficients that contribute minimally to the overall performance-particularly those at the edges of the coefficient vector-this approach streamlines the filtering process. Additionally, adjusting the norm of the remaining coefficients can further reduce their dynamic range, which not only enhances numerical stability but also minimizes the usage of hardware resources. This reduction in computational load is particularly beneficial in resource-constrained environments, such as embedded systems and real-time video processing applications, where efficient use of processing power and memory is critical.

[0288] Moreover, the design incorporates a precision-retention strategy that focuses on retaining high-energy coefficients while selectively zeroing out low-impact edge coefficients. This targeted approach ensures that the most critical components of the filter-those that significantly influence interpolation accuracy-are preserved. By maintaining these central coefficients, the filter can achieve a high degree of accuracy, particularly in high-precision interpolation scenarios where even minor deviations can lead to noticeable artifacts. This strategy not only enhances the overall performance of the filter but also allows it to meet stringent quality requirements in applications such as video coding, and digital video signal processing, where precision is paramount.

[0289] Furthermore, the implementation of a norm-adaptive pruning mechanism allows the filter to dynamically adjust its design based on varying use cases and operational conditions. This adaptability ensures that the filter can optimize its performance for different scenarios, whether it be low-complexity tasks that prioritize speed and efficiency or high-precision applications that demand meticulous accuracy. By continuously analyzing the signal characteristics and adjusting the coefficient set accordingly, the filter can maintain optimal performance across a wide range of applications. This enhanced adaptiveness not only improves the filter's versatility but also enables it to respond effectively to changing requirements, making it a robust solution for diverse signal processing challenges.

[0290] FIG. 7 conceptually illustrates an apparatus 500 with which some embodiments of the invention are implemented. The apparatus may be a decoding device or an encoding device. The apparatus 500 may be a computer (e.g., a desktop computer, personal computer, tablet computer, etc. ) , phone, PDA, or any other sort of electronic device. Such an apparatus includes various types of computer readable media and interfaces for various other types of computer readable media. The apparatus 500 includes a processor 502 and a memory 504. The memory 504 is configured to store executable instructions that, when executed by the processor, cause the processor to perform any one of the foregoing decoding or encoding methods.

[0291] The processor 502 may be a single processor or a multi-core processor in different embodiments. In some embodiments, the processor may include a GPU, NPU or DSP which may offload various computations or complement the image processing provided by the processor 502.

[0292] Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media) . Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM) , recordable compact discs (CD-R) , rewritable compact discs (CD-RW) , read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM) , a variety of recordable / rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc. ) , flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc. ) , magnetic and / or solid state hard drives, read-only and recordable discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.

[0293] While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs) . In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself. In addition, some embodiments execute software stored in programmable logic devices (PLDs) , ROM, or RAM devices.

[0294] As used in this specification and any claims of this application, the terms “computer” , “server” , “processor” , and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. As used in this specification and any claims of this application, the terms “computer readable medium, ” “computer readable media, ” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.

[0295] The present disclosure further provides a computer readable media which is configured to store executable instructions. When the instructions are executed by a processor, the processor may perform any one of the foregoing methods and processes. Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium) . When these instructions are executed by one or more computational or processing unit (s) (e.g., one or more processors, cores of processors, or other processing units) , they cause the processing unit (s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, random access memory (RAM) chips, hard drives, erasable programmable read only memories (EPROMs) , electrically erasable programmable read-only memories (EEPROMs) , etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections.

[0296] In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs.

[0297] While the disclosure has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. In addition, a number of the figures conceptually illustrate processes and methods. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process.

[0298] The foregoing is merely embodiments of the present disclosure, and is not intended to limit the scope of the disclosure. Any transformation of equivalent structure or equivalent process which uses the specification and the accompanying drawings of the present disclosure, or directly or indirectly application in other related technical fields, are likewise included within the scope of the protection of the present disclosure.

Claims

1.A decoding method, comprising:determining a plurality of reference samples for a prediction mode;determining a prototype filter;acquiring an updated filter based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter; andfiltering the plurality of reference samples with the updated filter to generate predicted samples of a current block.2.The method of claim 1, wherein the trimming one or more coefficients of the prototype filter comprises:determining a trimming length K, wherein K is a positive integer; andsetting values of first K coefficients and / or last K coefficients of the prototype filter to zero; orsetting values of first K coefficients and / or last K coefficients of the prototype filter to positive one or negative one.3.The method of claim 2, wherein the determining the trimming length K comprises:acquiring a target tap length of the updated filter; anddetermining the trimming length K based on the target tap length of the updated filter and a tap length of the prototype filter.4.The method of claim 2, wherein the determining the trimming length K comprises:acquiring a magnitude threshold;determining a first position before which absolute values of coefficients of the prototype filter are less than the magnitude threshold; ordetermining a second position after which absolute values of coefficients of the prototype filter are less than the magnitude threshold; anddetermining the trimming length K based on the first position or the second position.5.The method of claim 1, wherein the trimming one or more coefficients of the prototype filter comprises:acquiring a target tap number M, wherein M is a positive integer;keeping M coefficients located at middle of the prototype filter; andtrimming other coefficients of the prototype filter to a target value.6.The method of claim 1, wherein the trimming one or more coefficients of the prototype filter comprises:acquiring a value threshold T;keeping a plurality of coefficients located at middle of the prototype filter of which a sum is no less than a product of the value threshold and a total value of the prototype filter; andtrimming other coefficients of the prototype filter to a target value.7.The method of claim 1, wherein the truncating one or more coefficients of the normalized integer form of the prototype filter comprises:determining a truncating threshold;removing coefficients of the prototype filter whose values are less than the truncating threshold.8.The method of claim 1, wherein the trimming and / or truncating one or more coefficients of the prototype filter comprises:trimming and / or truncating one or more coefficients of a normalized integer form of the prototype filter.9.The method of claim 8, wherein the normalized integer form of the prototype filter has a corresponding norm number, wherein the method further comprises:calculating a coefficient adjustment value based on a difference between sum of coefficients of the updated filter and the norm number; andadjusting the coefficients of the updated filter based on the coefficient adjustment value.10.The method of claim 9, wherein the adjusting the coefficients of the updated filter based on the coefficient adjustment value comprises:determining weights of the coefficients of the updated filter; andadjusting the coefficients of the updated filter based on the weights and the coefficient adjustment value.11.The method of claim 10, whereina weight of a coefficient of the updated filter is determined based on:a difference between the coefficient and a product of a corresponding coefficient of the integer form of the prototype filter and the norm number; andthe product of the corresponding coefficient of the integer form of the prototype filter and the norm number.12.The method of claim 11, wherein the adjusting the coefficients of the updated filter based on the weights and the coefficient adjustment value comprises:evenly distributing the coefficient adjustment value to coefficients of the updated filter with largest weights; orevenly distributing the coefficient adjustment value to coefficients of the updated filter with largest weights and a same sign as the coefficient adjustment value; orevenly distributing one half of the coefficient adjustment value to coefficients of a first half of the updated filter with largest weights, and distributing another half of the coefficient adjustment value to coefficients of a second half of the updated filter, positions of which correspond to the coefficients of the first half of the updated filter; ordynamically distributing the coefficient adjustment value to coefficients of the updated filter with largest weights.13.The method of claim 10, wherein the adjusting the coefficients of the updated filter based on the weights and the coefficient adjustment value comprises:distributing the coefficient adjustment value to coefficients of the updated filter proportionally to the weights of the coefficients of the updated filter.14.The method of claim 13, wherein the determining the weights of the coefficients of the updated filter comprises:determining optimal weights of the coefficients of the updated filter by minimizing a difference between original samples and predicted samples which are generated by applying the updated filter with the weights of the coefficients to reference samples of the original samples.15.The method of claim 1, further comprising:adjusting the coefficients of the updated filter by adding values of the one or more coefficients of the prototype filter that are trimmed or truncated to the coefficients of the updated filter.16.The method of claim 1, wherein the determining the prototype filter comprises:acquiring a plurality of candidate filters;determining the prototype filter from the plurality of candidate filters based on a prediction angle of the prediction mode and / or a size of the current block.17.The method of claim 1, wherein the determining the prototype filter comprises:acquiring a plurality of candidate filters;determining the prototype filter from the plurality of candidate filters based on template matching costs of the plurality of candidate filters in a template area of the current block.18.A decoding method, comprising:determining a plurality of reference samples for a prediction mode;determining a first prototype filter and a second prototype filter;acquiring a first updated filter based on the first prototype filter by trimming and / or truncating one or more coefficients of the first prototype filter;acquiring a second updated filter based on the second prototype filter by trimming and / or truncating one or more coefficients of the second prototype filter;selecting a target filter from the first updated filter and the second updated filter; andfiltering the plurality of reference samples with the target filter to generate predicted samples of a current block.19.The method of claim 18, wherein the selecting the target filter from the first updated filter and the second updated filter comprises:selecting the target filter based on a prediction angle of the prediction mode and / or a size of the current block.20.The method of claim 18, wherein the selecting the target filter from the first updated filter and the second updated filter comprises:selecting the target filter based on template matching costs of the first updated filter and the second updated filter in a template area of the current block.21.An encoding method, comprising:determining a plurality of reference samples for a prediction mode;determining a prototype filter;acquiring an updated filter based on the prototype filter by trimming and / or truncating one or more coefficients of the prototype filter; andfiltering the plurality of reference samples with the updated filter to generate predicted samples of a current block.22.An apparatus for video decoding or encoding, comprising a processor and a memory, wherein the memory is configured to store executable instructions that, when executed by the processor, cause the processor to perform the method of any of claims 1 to 21.23.A computer readable non-transitory medium storing executable instructions that, when executed by a processor, cause the processor to perform the method of any of claims 1 to 21.