Method of video encoding and decoding

The method improves video coding efficiency by using adaptive integer arithmetic and noise-aware regression modeling to address precision loss and computational inefficiencies in linear regression, enhancing accuracy and reducing complexity in video coding systems.

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

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SHENZHEN TCL NEW-TECH CO LTD
Filing Date
2025-01-24
Publication Date
2026-07-30

AI Technical Summary

Technical Problem

Current video coding systems face precision loss and increased prediction errors due to hardware constraints and computational inefficiencies in integer arithmetic implementations of linear regression, particularly in higher bit depth and sophisticated prediction modes, which are exacerbated by rounding errors and assumptions of error-free independent variables.

Method used

Implement integer arithmetic with adaptive right shift values and fractional precision for slope and offset calculations, using methods such as total least squares regression to account for noise in input samples, and introduce simplified arithmetic operations to optimize computational efficiency and precision.

Benefits of technology

Enhances coding efficiency by reducing computational complexity, minimizing rounding errors, and improving prediction accuracy through adaptive fractional bit allocation and noise-aware regression modeling, suitable for various video coding standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025075018_30072026_PF_FP_ABST
    Figure CN2025075018_30072026_PF_FP_ABST
Patent Text Reader

Abstract

This disclosure presents a method of video encoding and decoding. The method uses a linear model to perform prediction for a pixel in a video frame of the bitstream. Coefficients of the linear model are obtained using integer arithmetic. The integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation. An embodiment of the method bypasses calculation of a first right shift value used in a linear model when satisfying conditions related to at least one of: a bit depth of a video frame; a maximum number of input samples for prediction; or a bit width of integer representation for arithmetic calculation. Bypassing the calculation comprises setting the first right shift value equal to the second right shift value or zero.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD OF VIDEO ENCODING AND DECODINGBACKGROUND OF DISCLOSURE1. Field of Disclosure

[0001] The present disclosure relates to the field of image processing, and more particularly, to an encoding and method of video decoding. 2. Description of Related Art

[0002] In modern video coding standards, several prediction modes utilize linear regression to generate prediction blocks for improved coding efficiency. Notable examples include Cross-Component Linear Model (CCLM) , Gradient Linear Model (GLM) , and Local Illumination Compensation (LIC) . CCLM is an intra chroma mode where the chroma samples are predicted from co-located luma samples; GLM is another intra chroma mode where the chroma samples are predicted from the gradients of co-located luma samples; LIC is an inter prediction tool that adjusts the originally predicted samples using a linear transform. In these modes, a linear model whose coefficients typically contain a slope and an offset is used to compute the samples to be predicted, and linear regression is used to derive model coefficients. The choice of linear regression method is typically an approximation of ordinary least squares implemented using integer arithmetic.Technical Problem

[0003] Due to hardware constraints and computational efficiency requirements, these regression calculations are implemented using integer arithmetic rather than floating-point operations. Current implementations represent the linear model coefficients using fixed fractional bit depths, with slopes typically allocated 5 fractional bits and offsets rounded to integers. This fixed allocation can lead to precision loss and can increase prediction errors due to rounding errors of the model coefficients.

[0004] Additionally, the standard regression methods assume error-free independent variables, which may not hold true for reconstructed reference samples that contain quantization noise.

[0005] As video coding systems evolve to support higher bit depths and more sophisticated prediction modes, these limitations in coefficient precision and regression modelling can impact coding efficiency. Furthermore, the computational complexity of existing integer arithmetic implementations, which often require multiple shifting operations and iterative procedures, presents challenges for high-performance video coding applications.

[0006] Hence, a method of video encoding and decoding for addressing the challenge are desirable.SUMMARY

[0007] An object of the present disclosure is to propose a method of video encoding and decoding.

[0008] In a first aspect, an embodiment of the disclosure provides a method of video decoding comprising:receiving video signals of video frames; using a linear model to perform prediction for a pixel in a video frame of the bitstream, wherein  coefficients of the linear model are obtained using integer arithmetic, and the integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation; encoding the video frame to generate a coded video frame; and transmitting a bitstream including the coded video frame.

[0009] In a second aspect, an embodiment of the disclosure provides a method of video decoding, comprising: receiving a bitstream of coded video frames; and using a linear model to perform prediction for a pixel in a coded video frame of the bitstream, wherein  coefficients of the linear model are obtained using integer arithmetic, and the integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation.

[0010] In a third aspect, an embodiment of the disclosure provides a method of video encoding comprising: receiving video signals of video frames; performing prediction for a pixel in a video frame of the bitstream using a linear model, wherein the linear  model comprises a slope and an offset, the slope comprises a numerator and a denominator; encoding the video frame to generate a coded video frame; and transmitting a bitstream including the coded video frame; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an adaptive right shift value is calculated based on the multiplication result, wherein the adaptive right  shift value is determined based on a position of a most significant bit (MSB) of the multiplication result, and the adaptive right shift value is used to right shift the multiplication result to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted  multiplication result and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0011] In a fourth aspect, an embodiment of the disclosure provides a method of video decoding comprising: receiving a bitstream of coded video frames; and performing prediction for a pixel in a coded video frame of the bitstream using a linear model, wherein  the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an adaptive right shift value is calculated based on the multiplication result, wherein the adaptive right  shift value is determined based on a position of a most significant bit (MSB) of the multiplication result, and the adaptive right shift value is used to right shift the multiplication result to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted  multiplication result and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0012] In a fifth aspect, an embodiment of the disclosure provides a method of video encoding comprising:receiving video signals of video frames; performing prediction for a pixel in a video frame of the bitstream using a linear regression model,  wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; encoding the video frame to generate a coded video frame; and transmitting a bitstream including the coded video frame; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an expected slope value is obtained based on prior knowledge of a prediction mode; an adaptive right shift value is calculated based on a difference between the multiplication result and  the expected slope value, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the difference, and the adaptive right shift value is used to right shift the difference to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted difference  and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0013] In a sixth aspect, an embodiment of the disclosure provides a method of video decoding, comprising: receiving a bitstream of coded video frames; and performing prediction for a pixel in a coded video frame of the bitstream using a linear regression model,  wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an expected slope value is obtained based on prior knowledge of a prediction mode; an adaptive right shift value is calculated based on a difference between the multiplication result and  the expected slope value, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the difference, and the adaptive right shift value is used to right shift the difference to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted  difference and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0014] In a seventh aspect, an embodiment of the disclosure provides a method of video encoding comprising: receiving video signals of video frames; performing prediction for a pixel in a video frame of the bitstream using a linear model, wherein the linear  model comprises a slope and an offset with fractional precision; encoding the video frame to generate a coded video frame; and transmitting a bitstream including the coded video frame; wherein rounding an output of the linear model to integer precision is performed after calculating the  linear model with the slope and offset; and wherein for the offset with fractional precision a first term is obtained by left shifting a mean value of dependent variable samples by a first shift value; a second term is obtained by multiplying the slope with a mean value of independent variable samples; and the offset value is a difference between the first term and the second term.

[0015] In an eighth aspect, an embodiment of the disclosure provides a method of video decoding comprising: receiving a bitstream of coded video frames; and performing prediction for a pixel in a coded video frame of the bitstream using a linear model, wherein  the linear model comprises a slope and an offset with fractional precision; wherein rounding an output of the linear model to integer precision is performed after calculating the  linear model with the slope and offset; and wherein for the offset with fractional precision a first term is obtained by left shifting a mean value of dependent variable samples by a first shift value; a second term is obtained by multiplying the slope with a mean value of independent variable samples; and the offset value is a difference between the first term and the second term.

[0016] In a nineth aspect, an embodiment of the disclosure provides a method of video encoding comprising: receiving video signals of video frames; calculating a slope and an offset in a total least squares regression model of which both the independent  variable and dependent variable contain errors; performing prediction for a pixel in a video frame of the bitstream using the total least squares regression  model, wherein performing prediction using the total least squares regression model comprises integer arithmetic procedures for a numerator of the slope and a denominator of the slope; encoding the video frame to generate a coded video frame; and transmitting a bitstream including the coded video frame.

[0017] In a tenth aspect, an embodiment of the disclosure provides a method of video decoding comprising: receiving a bitstream of coded video frames; calculating a slope and an offset in a total least squares regression model of which both the independent  variable and dependent variable contain errors; and performing prediction for a pixel in a coded video frame of the bitstream using the total least squares  regression model; wherein performing prediction using the total least squares regression model comprises integer arithmetic  procedures for a numerator of the slope and a denominator of the slope.

[0018] In an eleventh aspect, an embodiment of the disclosure provides an encoding device comprising a processor configured to call and run a computer program stored in a memory, to cause a device in which the processor is installed to execute the disclosed method.

[0019] In a twelfth aspect, an embodiment of the disclosure provides a decoding device comprising a processor configured to call and run a computer program stored in a memory, to cause a device in which the chip is installed to execute the disclosed method and any combination of embodiments of the disclosed method.

[0020] The disclosed method may be programmed as computer executable instructions stored in non-transitory computer readable medium. The non-transitory computer readable medium, when loaded to a computer, directs a processor of the computer to execute the disclosed method.

[0021] The non-transitory computer readable medium may comprise at least one from a group consisting of:a hard disk, a CD-ROM, an optical storage device, a magnetic storage device, a Read Only Memory, a Programmable Read Only Memory, an Erasable Programmable Read Only Memory, EPROM, an Electrically Erasable Programmable Read Only Memory and a Flash memory.

[0022] The disclosed method may be programmed as a computer program product that causes a computer to execute the disclosed method.

[0023] The disclosed method may be programmed as a computer program that causes a computer to execute the disclosed method.BRIEF DESCRIPTION OF DRAWINGS

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

[0025] FIG. 1 illustrates a schematic view of an encoding system.

[0026] FIG. 2 illustrates a schematic view of a decoding system.

[0027] FIG. 3 illustrates a schematic view of an example of a communication system.

[0028] FIG. 4 illustrates a schematic view of another example of a communication system.

[0029] FIG. 5 illustrates a schematic view showing a Sobel operators on the luma samples.

[0030] FIG. 6 illustrates a schematic view showing an embodiment of the method of video encoding.

[0031] FIG. 7 illustrates a schematic view showing an embodiment of the method of video decoding.

[0032] FIG. 8 illustrates a schematic view showing an embodiment of the method of video encoding.

[0033] FIG. 9 illustrates a schematic view showing an embodiment of the method of video decoding.

[0034] FIG. 10 illustrates a schematic view showing an embodiment of the method of video encoding.

[0035] FIG. 11 illustrates a schematic view showing an embodiment of the method of video decoding.

[0036] FIG. 12 illustrates a schematic view showing an embodiment of the method of video encoding.

[0037] FIG. 13 illustrates a schematic view showing an embodiment of the method of video decoding.

[0038] FIG. 14 illustrates a schematic view showing an embodiment of the method of video encoding.

[0039] FIG. 15 illustrates a schematic view showing an embodiment of the method of video decoding.

[0040] FIG. 16 illustrates a schematic view showing a decoding process and computation procedures of CCLM, GLM or LIC.

[0041] FIG. 17 illustrates a schematic view showing an embodiment of the method of video decoding.

[0042] FIG. 18 illustrates a schematic view showing a process of total least squares regression for regression-based modes.

[0043] FIG. 19 illustrates a schematic view showing integer arithmetic and shifting.

[0044] FIG. 20 illustrates a schematic view showing a chip or executing the disclosed method in an encoder.

[0045] FIG. 21 illustrates a schematic view showing a chip or executing the disclosed method in a decoder.DETAILED DESCRIPTION OF EMBODIMENTS

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

[0047] To facilitate understanding of the technical solutions presented in this application’s embodiments, a concise overview of the video encoding and decoding system will be given in the following.

[0048] As shown in FIG. 1, a video encoding system 110 is composed of multiple modules, including a block partitioning unit 1101, transform and quantization unit 1102, intra-frame estimation unit 1103, intra-frame prediction unit 1104, motion compensation unit 1105, motion estimation unit 1106, an inverse transformation and inverse quantization unit 1107, a filter control analysis unit 1108, a filtering unit 1109, an encoding unit 1110, an encoded image buffer unit 1111, and a subtractor 1112. The video encoding system 110 may be implemented as an encoder, an encoding device, a computer program, a system on chip (SIC) , an integrated circuit (IC) , or a chip. The intra-frame prediction unit 1104 may be implemented as a computer program, a system on chip (SIC) , an integrated circuit (IC) , or a chip.

[0049] Original video signals comprise video frames. Each video frame can be divided into blocks by the block partitioning unit 1101. For each of the video frames, the subtractor 1112 generates residual pixel information of a residual frame by subtracting the video frame by prediction blocks output by the intra-frame prediction unit 1104 or the motion compensation unit 1105. The residual pixel information obtained after intra-frame prediction or inter-frame prediction (motion compensation) , is transformed by the transformation and quantization unit 1102. The transformation includes transforming the residual pixel information from the pixel domain to a transform domain to generate resulting transform coefficients, and the resulting transform coefficients are quantized to further reduce the bit rate. The intra-frame estimation unit 1103 performs intra-frame estimation, and the intra-frame prediction unit 1104 performs intra-frame prediction on the video reconstruction blocks. Motion estimation performed by the motion estimation unit 1106 is a process of generating a motion vector that can estimate the motion of the video reconstruction block, and then motion compensation is performed by the motion compensation unit 1105 based on the determined motion vector. After determining an intra-frame prediction mode, the intra-frame prediction unit 1104 provides selected intra-frame predicted data to the encoding unit 1110, and the motion estimation unit 1106 also sends calculated motion vector data to the encoding unit 1110. The inverse transform and inverse quantization unit 1107 reconstructs the video reconstruction blocks and reconstructs a residual block in the pixel domain, and the filtering unit 1109 is controlled by the filter analysis unit 1108 to remove the blocking artifacts in the reconstructed residual block, and the encoding unit 1110 adds the reconstructed residual block to the prediction block of the encoded image buffer unit 1111 to generate a reconstructed block. The encoding unit 1110 is used for encoding various encoding parameters and quantized transform coefficients (quantized transform coefficients) into bitstream, and outputs the bitstream of the video signals. The encoded image buffer unit 1111 is used for storing reconstructed blocks as the reference blocks for intra-frame prediction. As the video image encoding progresses, new reconstructed blocks are continuously generated, and these blocks will be stored in the encoded image buffer unit 1111.

[0050] As shown in FIG. 2, the video decoding system 120 is composed of multiple modules comprising a decoding unit 1201, an inverse transform and inverse quantization unit 1202, an intra-frame prediction unit 1203, a motion compensation unit 1204, a filtering unit 1205, a decoded image buffer unit 1206 and a post filtering unit 1207. The video decoding system 120 may be implemented as a decoder, a decoding device, a computer program, a system on chip (SIC) , an integrated circuit (IC) , or a chip. The intra-frame prediction unit 1203 may be implemented as a computer program, a system on chip (SIC) , an integrated circuit (IC) , or a chip.

[0051] The input signals of video frames are encoded by the video encoding system 110 to obtain an output bitstream. The video encoding system 110 transmits the bitstream to the video decoding system 120. The video decoding system 120 receives the bitstream representing the video frames in an encoded format (i.e., in a compressed format) . In the video decoding system 120, the bitstream is processed by the decoding unit 1201 to obtain decoded transform coefficients. The inverse transform and inverse quantization unit 1202 process the transform coefficients to generate a residual block in the pixel domain. The intra-frame prediction unit 1203 is operable to generate an intra-frame prediction block for a current video decoding block (i.e., current video block that undergoes video decoding) based on a determined intra-frame prediction mode and data from previously decoded blocks of the current video frame or picture. The motion compensation unit 1204 determines the inter-frame prediction information for the current video decoding block and generates an inter-frame prediction block by parsing the motion vector and other associated syntax elements. Finally, the decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 1202 and the corresponding prediction block generated by the intra-frame prediction unit 1203 or the motion compensation unit 1204. In order to improve video quality, the decoded video blocks are filtered through the filtering unit 1205 to remove blocking artifacts. The decoded video block is then stored in the decoded image buffer unit 1206 as the reference block for subsequent intra-prediction or motion compensation, and for video output, i.e., to reproduce and reconstruct the original video signals. The output video can be optionally further processed by a post filtering unit 1207 for more suitable or enhanced viewing experiences.

[0052] The embodiments of the present disclosure are mainly used for the intra-frame prediction unit 1104 of the video encoding system 110 and the intra-frame prediction unit 1203 of the video decoding system 120. Similarly, the embodiments of the present disclosure are mainly used for the inter-frame prediction in the motion compensation unit 1105 and the motion compensation unit 1204. If a better prediction effect can be obtained in the video encoding system 110 through the method of video encoding and decoding provided by the embodiments of the present application, the quality of video decoding and reconstruction can also be improved. The video decoding system 120 receives the bitstream representing the video frames.

[0053] The following are several implementation examples, demonstrating possible executions for this disclosure within video codec standards.

[0054] With reference to FIG. 3, a system including a first image processing device 10a and a second image processing device 10b. The first image processing device 10a may operates as an encoding device comprising a processor 75a. The processor 75a comprises an encoder configured to execute the disclosed method of video encoding. The encoder encodes image or video frames into bit streams, and the processor 75a transmits the bit steam to the processor 75b. The second image processing device 10b may operates as a decoding device comprising a processor 75b. The processor 75b comprises a decoder configured to execute the disclosed method of video decoding.

[0055] Similarly, the second image processing device 10b may operate as an encoding device comprising a processor 75b. The processor 75b comprises an encoder configured to execute the disclosed method of video encoding. The encoder encodes image or video frames into bit streams, and the processor 75b transmits the bit steam to the processor 75a. The first image processing device 10a may operates as a decoding device comprising a processor 75b. The processor 75b comprises a decoder configured to execute the disclosed method of video decoding.

[0056] In some embodiments of the disclosure, the encoder and the decoder may be implemented into computer readable programs or instructions. A device when executing the programs or instructions performs embodiments of the disclosed method. An example of the electronic device in the description may include one of the device 10a or device 10b. The device 10a may communicate with the device 10b through a direct connection or through a base station and / or a network device entity.

[0057] With reference to FIG. 4, the electronic device 10a may communicate with the electronic device 10b through a wireline or a wireless communication connection. One of the electronic device 10a or electronic device 10b may serve as an image encoder and the other may serve as an image decoder. Each of the electronic device 10a and electronic device 10b may include both an image encoder and an image decoder.

[0058] An image encoder may be implemented as an intra-frame prediction unit, a chip, an electronic device, or a video encoding system. An image decoder may be implemented as an intra-frame prediction unit, a chip, an electronic device, or a video decoding system. The intra-frame prediction unit in an image encoder and / or an image decoder performs method of video encoding and decoding.

[0059] Linear regression in image and video coding

[0060] In Enhanced Compression Model developed and maintained by the Joint Video Expert Team (JVET) , several prediction modes use linear regression to generate prediction blocks. Notable examples of these prediction modes include Cross-Component Linear Model (CCLM) , Gradient Linear Model (GLM) , Convolutional Cross-Component Model (CCCM) , Local Illumination Compensation (LIC) , etc. Such prediction modes are used in parallel with other intra and / or inter prediction modes like DC mode, planar mode, angular modes, chroma direct mode, etc. In the decoding unit 1201 of the video decoding system, bitstreams are decoded to decide the prediction mode to be used for the current block.

[0061] Cross-Component Linear Model (CCLM)

[0062] CCLM is a cross-component intra prediction mode that predicts chroma image or chroma block using reconstructed luma image or luma block. The term ‘cross-component’s tems from the fact that prediction is made from one colour component to another.

[0063] The formula for predicting a chroma block (Cb or Cr) in CCLM is as follows:

[0064] PredC (x, y) =α·Rec′L (x, y) +β             1

[0065] Where PredC (x, y) is the value of a pixel (x, y) to be predicted in a chroma block, Rec′L (x, y) is the value of a corresponding pixel in the co-located reconstructed luma block, which has been adjusted to the size of the chroma block and (x, y) is the coordinate of the pixel. As the dimensions (height and width) of the luma image are twice the dimensions of the chroma image in 4: 2: 0 picture format, Rec′L is usually obtained by downsampling the reconstructed luma image RecL.

[0066] The model coefficients α and β are calculated by linear regression using ordinary least squares method. The input samples include a row of pixels adjacent to the top of the current block and a column of pixels adjacent to the left of the current block. The analytical solution to model coefficients α and β is expressed as:

[0067]

[0068] β=M (tC) -α·M (tL)                3

[0069] Where cov (L, C) is the covariance between luma and chroma input samples in the template area, var(L) is the variance of luma input samples in the template area, tL is the value of a pixel in the downsampled luma template area, tC is the value of a pixel in the chroma template area, (x, y) is the coordinate of the pixel, and M (X) is the mean of sample X in the corresponding template area.

[0070] As per the above-mentioned common aspects, chroma block is the current block to be predicted, luma block serves as the reference block, and the template areas are the reconstructed pixels on the left and the top of respective blocks.

[0071] Gradient Linear Model (GLM)

[0072] GLM is another cross-component prediction mode that is similar to CCLM. Instead of directly using luma sample value as in CCLM, GLM utilizes luma sample gradients to derive the linear model. Therefore, the formula for predicting a chroma block (Cb or Cr) is changed to:

[0073] PredC (x, y) =α·G (x, y) +β

[0074] With reference to FIG. 5, the gradient G can be computed by applying one of the following Sobel operators on the luma samples.

[0075] Details can be obtained from: C.-W. Kuo, X. Xiu, N. Yan, H. -J. Jhu, W. Chen, H. Gao, X. Wan, AHG12: Enhanced CCLM, document JVET- Z0140, Joint Video Experts Team (JVET) , Apr. 2022. P.Astola, J. Lainema, R. G. Youvalari, A. Aminlou, K. Panusopone, C. -W. Kuo, H. -J. Jhu, X. Xiu, N. Yan, W.  Chen, X. Wang, EE2-1.1c, 1.3a and 1.3b: Combined tests of EE2-1.1a, 1.1b and 1.2, document JVET-AA0126, Joint Video Experts Team (JVET) , Jul. 2022.

[0076] Local Illumination Compensation (LIC)

[0077] LIC is a prediction enhancement method that can be applied to intra and inter prediction. For either prediction type, a reference block is found by the above-mentioned motion compensation unit from the same frame of the current block (i.e., in intra prediction) or from a different frame than the current block (i.e., in inter prediction) . To compensate the illumination difference between reference block and current block, LIC is used to measure such difference and adjust prediction blocks. The formula for generating the prediction block is:

[0078] Pred (x, y) =α·Ref (x, y) +β             4

[0079] Where Pred (x, y) is the value of pixel (x, y) to be predicted, and Ref (x, y) is the value of pixel (x, y) in the reference block.

[0080] To calculate the model coefficients α and β, template areas are defined around both reference block and current block by choosing one or more rows adjacent to the top of the respective blocks and one or more columns adjacent to the left of the respective blocks. The calculation procedures are similar to the procedures of CCLM mentioned above.

[0081] Multi-Model Linear Model (MMLM)

[0082] MMLM is an extension of linear model prediction. In recent development of video coding standards, MMLM is applied as a variant of CCLM, GLM and LIC, which includes Multi-Model CCLM (MM-CCLM) , Multi-Model GLM (MM-GLM) and Multi-Model LIC (MM-LIC) respectively. In contrast to ordinary linear model prediction methods where the whole template area is regarded as a single training set, and one linear model is derived for the predicting the current block, MMLM classifies all pixels in the template area into two training sets and derives one linear model for each training set for making the prediction. For example, in MM-CCLM, pixels in the template area are classified based on whether its luma value is less than the average luma value in the whole template area. Meanwhile in the prediction stage, pixels in the current block can also be classified using the same criterion and the corresponding linear model is applied for the prediction.

[0083] The formula for predicting a chroma block (Cb or Cr) in MM-CCLM is as follows:

[0084]

[0085] Where ML is the mean value of luma samples in the template area. Function coefficients {α0, β0} is used for predicting pixels whose luma values are smaller than or equal to ML, and {α1, β1} is used for predicting pixels whose luma values are greater than ML. They are obtained separately:

[0086]

[0087] β0=M (tC0) -α0·M (tL0)                7

[0088]

[0089] β1=M (tC1) -α1·M (tL1)                9

[0090] Where tL0 or tL1 is the value of a pixel in the downsampled luma template area, tC0 or tC1 is the value of a pixel in the chroma template area, (x, y) is the coordinate of the pixel, and M (X) is the mean of sample X in the corresponding template area; tL0 and tC0 only include the pixels whose luma values are smaller than or equal to ML; tL1 and tC1 only include the pixels whose luma values are greater than ML.

[0091] Similarly, in MM-GLM and MM-LIC, two linear model are derived. One model is derived from the pixels whose luma values are less than or equal to the mean of luma values of all pixels in the template area, and the other model is derived from those whose luma values are greater than the mean of luma values of all pixels in the template area.

[0092] Implementation of regression-based modes in image and video coding

[0093] Integer representation of model coefficients and predictor calculation

[0094] In image and video coding, algorithms are commonly implemented using integer arithmetic. As of Enhanced Compression Model (ECM) version 15.0, the data structure used to represent the linear model in CCLM, GLM and LIC consists of three integers {a, b, S} , where a represents the slope, b represents the offset, and S represents a shift value. The relationship between the real number model coefficients {α, β} and the integer representations {a, b, S} is roughly:

[0095]

[0096]

[0097] Where denotes rounding to the nearest integer. With input variable x, the predicted value y is computed as:

[0098] y= (a·x>>S) +b                12

[0099] Integer arithmetic of linear regression

[0100] To obtain the coefficients, integer arithmetic is used. In ordinary least squares regression, the slope α is computed as: Where n is the number of input samples; xi represents a value of the independent variable of the i-th sample; and yi represents a value of the dependent variable of the i-th sample. Let s1=sxy-sx·sy / n and s2=sxx-sx·sx / n, the value of α is obtained by dividing s1 by s2:

[0101] For fast implementation and using integer arithmetic, division is replaced by a multiplication. The implementation is as follows: Table 1 denotes a floor operator which rounds down to the nearest integer that is smaller or equal to the input  value. is the floor operator (rounds down) . is the ceiling operator (rounds up) . denotes rounding to the nearest integer. The operator >> represents a right shift operation, which is equivalent to division by a power of 2. For  example, x >> n divides x by 2n. The operator << represents a left shift operation, which is equivalent to multiplication by a power of 2. For  example, x << n multiplies x by 2n. A (Accuracy / precision level) : For CCLM and GLM: A = D + 4. For LIC: A = 15. The “A” represents the target precision / accuracy level and determines the size of look-up table (LUT)  values. The LUT contains pre-computed values of to avoid division operations. D (Image bit depth) : D represents the bit depth of the input image. The image bit depth D is typically up to 12 bits for internal processing. Typical values are 8 or 10 for most image / video data. The image bit depth D affects the dynamic range of pixel values. S*(Shift value) : S*= A -5 + r2 -r1 The S*is used to adjust the scale of the final multiplication result. Regarding components of S*: The A contributes higher precision. -5 aims to place the MSB at the 5th bit position. r2 compensates for right shift of s2. -r1 compensates for right shift of s1.

[0102] In this implementation, A is the accuracy level that is fixed or depends on image bit depth D, which is up to 12 for the internal processing. s1 and s2 are quantized and shifted to become and to limit the dynamic ranges and prevent data overflow. s2t is a shifted inverse of and the value is obtained from a look-up table. S* is the bit shift value that is determined by the scale of s1 and s2 and a targeted shift value.

[0103] For CCLM and GLM, if the absolute value of a is less than 32, a is left shifted so that its most significant bit (MSB) is located at the 5th least significant bit (using zero-based indexing) , and S is adjusted accordingly. a:=a<<n′                 15 S:=S+n′                 16 The data assignment symbol := indicates assigning the value to its right to the variable to its left. The value of a is updated / assigned to be a left-shifted by n' bits. The value of S is updated / assigned to be the current S plus n' .

[0104] After a and S are calculated, the offset is then calculated as:

[0105] All intermediate variables in the linear regression procedures and the model coefficients are represented using 32-bit or 64-bit signed integer. The input variable x and the predicted value y is truncated to 16-bit signed integer.

[0106] Fractional precision of CCLM, GLM and LIC

[0107] As of ECM version 15.0, two implementations are used in these prediction modes. 1. In CCLM and GLM: a、Slope is coded with at most 5 fractional bits and at most 6 significant bits (excluding sign bit) ; the range of slope is clipped to between -8 and +8. b、Offset is rounded to integer. c、Intermediate variables are represented using 64-bit integer while output coefficients are  represented using 32-bit integer. d、MM-CCLM and MM-GLM use the same configurations. 2. In LIC: a、Slope is coded with 5 fractional bits; the range of slope is clipped to between 0 and +4. b、Offset is rounded to integer. c、Intermediate variables and output coefficients are represented using 32-bit integer. d、MM-LIC does not use the same configurations but instead use the configurations in CCLM and  GLM.

[0108] Details of the above-mentioned implementations and configurations can be obtained from: M. Coban, R. -L. Liao, K. Naser, J.  L. Zhang, Algorithm description of Enhanced Compression Model 15 (ECM 15) , document JVET-AJ2025, Joint Video Experts Team (JVET) , Nov. 2024. R.Yu, V. Seregin, M. Coban, M. Karczewicz, AHG12: 12-bit internal bit depth for ECM, document JVET- AJ0237, Joint Video Experts Team (JVET) , Nov. 2024.

[0109] Decoding process and computation procedures of CCLM, GLM and LIC:

[0110] FIG. 16 shows a decoding process and computation procedures of CCLM, GLM or LIC. Important steps include: 1. Obtaining input samples. The input samples are drawn from the templates of the current block and / or  the reference block. Details can be obtained in section

[0054] . 2. Deriving model coefficients using integer arithmetic. Linear regression is performed to obtain the  model coefficients of the corresponding prediction mode. For the derivation of model coefficients, details can be obtained in section

[0054] . For the implementation using integer arithmetic, details can be obtained in section

[0093] . 3. Generating prediction block. Details can be obtained in section

[0054] .

[0111] Identified problems:

[0112] Issues on operating bit depth:

[0113] Suboptimal fractional bit allocation:

[0114] As mentioned, LIC and MM-LIC use different fractional precision and clipping configurations. In existing technologies: · LIC uses constant number of fractional bits across all slopes. · MM-LIC uses the same fractional precision and clipping configurations as CCLM. However,  CCLM is a luma-to-chroma cross-component prediction model that has different statistical characteristics than LIC / MM-LIC.

[0115] When the illumination conditions around the reference block and the current block remain unchanged (which is the typical case) , the LIC regression should ideally return a slope of 1 and an offset of 0. Since this case occurs frequently, it would be beneficial to allocate more fractional bits for values near these expected results to achieve better precision. However, neither LIC nor MM-LIC currently implements such adaptive fractional bit allocation, instead using a fixed number of fractional bits regardless of the slope value.

[0116] In CCLM and GLM, limiting the number of fractional bits through pre-emptive cropping can significantly reduce precision when the slope is close to 0. This is particularly problematic because slopes near 0 occur frequently, as chroma components typically have smaller variations than luma components.

[0117] A dynamic fractional bit allocation approach would offer two benefits: 1. Better preservation of fractional bits for increased precision; and 2. Potential reduction in computational complexity by requiring fewer bit shift operations and iterations.

[0118] Unnecessary rounding to integer precision for the offsets:

[0119] In CCLM, GLM and LIC, the offset value is always an integer. From the point of view of computation complexity and memory usage, this is deemed to be unnecessary. If fractional precision is applied to offset, less rounding is needed in the regression procedures and potentially a more accurate or bias-free model can be obtained. By applying the same fractional precision to the offset and the slope, there would not be additional computations compared to an integer offset.

[0120] Current implementations of CCLM, GLM, and LIC restrict the offset value to integers. This integer-only restriction provides no computational or memory advantages.

[0121] Using fractional precision for the offset would offer several benefits: 1. Reduced rounding operations during regression calculations; 2. Potential improvements in model accuracy; 3. Reduced bias in predictions.

[0122] Moreover, when the same fractional precision is used for both offset and slope, the computational complexity remains equivalent to using integer offsets.

[0123] Issues on regression model formulation:

[0124] Video coding implementations typically use simple linear regression models, which assume that independent variables (regressors) contain minimal or no noise. However, this assumption is problematic because the training samples used in video coding come from previously coded areas, meaning both dependent and independent variables contain reconstruction errors from transform coefficient quantization.

[0125] This mismatch between assumption and reality suggests that error-in-variables regression methods, which account for noise in both variables, may be more appropriate for video coding applications.

[0126] Considerations on future image and video processing systems

[0127] Impacts of higher bit depth

[0128] High dynamic range (HDR) imaging is becoming increasingly prevalent in modern video processing systems. Higher internal bit depth in video coding has been shown to improve coding performance. However, this increased bit depth means quantization errors from limited fractional precision affect more significant bits, necessitating updated precision configurations.

[0129] The shift to higher bit depths has another important implication: intermediate calculations increasingly require 64-bit arithmetic. In this context, many existing overflow prevention procedures become redundant, as 64-bit arithmetic naturally prevents overflow in these calculations. These unnecessary safeguards can be eliminated to reduce computational complexity.

[0130] Unified designs for multiple coding tools

[0131] Video coding standards benefit from module reusability, as implementing shared components across multiple functions reduces development and maintenance costs. However, different coding modes exhibit distinct statistical characteristics in their input samples, creating a design tension. Therefore, achieving a unified design for regression-based modes requires modifications to accommodate these statistical differences while maintaining module reusability.

[0132] The disclosed method

[0133] Overview

[0134] The present invention proposes to introduce improved arithmetic and model for linear regression in image and video coding, focusing on intra and inter prediction.

[0135] Useful effects

[0136] The improvements fall into two main categories: enhanced arithmetic operations and advanced regression modelling. Optimized Critical Path

[0137] The arithmetic improvements encompass simplified integer arithmetic and adaptive fractional bit allocation for both slope and offset parameters. These changes deliver significant computational efficiency gains while maintaining compression performance. A key advantage is the shortened critical path in encoding and decoding operations -particularly important since regression-based coding tools typically have longer critical paths than other coding tools. The adaptive fractional bit allocation system maximizes the benefits of increased bit depth by intelligently shifting integer representations of fractional numbers based on their values. This enables higher precision without requiring additional memory or hardware capabilities. Enhanced Precision Management

[0138] The introduction of fractional bits to offset calculations brings another important benefit: reduced regression bias through minimized rounding errors. This improvement in precision contributes to better overall coding efficiency.

[0139] Beyond arithmetic improvements, this invention advances regression modelling by better handling noise and reconstruction errors in input samples. Traditional approaches assume reconstructed pixel samples are error-free. However, the assumption doesn't hold in practice. Our model explicitly accounts for measurement noise and reconstruction errors, resulting in more accurate correlation estimates between variables. This improved statistical modelling adapts to the actual characteristics of input samples, leading to more precise predictions.

[0140] These improvements work together to enhance both the computational efficiency and prediction accuracy of video coding systems, while maintaining hardware-friendly implementation characteristics.

[0141] Overall Solution

[0142] This invention addresses two key aspects of regression-based video coding. First, it improves the implementation of regression-based modes to optimize computational efficiency through reduced complexity, better bit depth utilization, and minimized rounding errors. Second, it introduces an enhanced regression model that accounts for sampling noise in input samples, leading to more accurate correlation estimates amongst the variables. These improvements leverage the increased capabilities of modern computing and video coding systems to better utilize available memory and processing resources.

[0143] The specific improvements fall into two categories. The first category focuses on arithmetic improvements for computing model coefficients: 1. Simplified integer arithmetic for slope calculation; 2. Adaptive fractional bit allocation for slope values; and 3. Fractional precision handling for offset values.

[0144] With reference to FIG. 17, this flowchart illustrates the key improvements introduced by the invention, particularly showing how the slope and offset calculations are handled using the improved arithmetic methods. The slope and offset calculations can be perform in parallel using the improved arithmetic methods. The parallel processing of slope and offset calculations suggests an optimization in the computation pipeline. The flowchart represents a complete decoding process for regression-based modes in video coding, starting from obtaining input samples, through the mathematical computations using improved arithmetic, to finally generating the prediction block that will be used in video reconstruction.

[0145] The second category introduces total least squares regression as an alternative modelling approach, providing better handling of noise in the input data.

[0146] These improvements are designed to be flexible -they can be implemented either individually or in combination, depending on specific needs. They are compatible with various coding modes that use linear regression for prediction coefficient calculation, making them applicable across multiple video coding standards including Moving Picture Experts Group (MPEG) , Alliance for Open Media (AOM) , and Audio and Video coding Standard of China (AVS) .

[0147] Solution #1: Deriving the slope with simplified integer arithmetic

[0148] Solution#1 contributes to accelerated computation in video coding. The key features for deriving the slope with simplified integer arithmetic include a linear regression algorithm that uses simplified implementations allowed by the bit depth in integer representation. Important procedures include: Computing the slope with simplified integer arithmetic -Based on the configurations of the video coding  system and the input data, the steps required for solving for the slope can be reduced. Detailed implementations can be obtained from embodiment #1.

[0149] Solution #2: Deriving the slope with adaptive fractional bit allocation

[0150] Solution #2 contributes to improved precision and accuracy in video coding. The key features include a linear regression algorithm that dynamically determines bit shifts in the integer representation of the fractional model coefficients. Important procedures include: Computing the slope with adaptive fractional bit allocation:

[0151] Specifically, at least one embodiment of the disclosure preserves more fractional bits in the slope through modified computation procedures. Detailed implementations are available in embodiments #2 and #3.

[0152] Solution #3: Deriving the offset with fractional precision

[0153] Solution #3 also contributes to improved precision and accuracy in video coding.

[0154] The key features for deriving the offset with fractional precision include allowing fractional values in the integer representation of the offset, along with corresponding procedures for generating prediction samples.

[0155] Important procedures encompass two main components: 1. First, computing the offset with fractional bits enables reduced rounding errors when evaluating mean  values of input samples. This improvement has a direct impact on the accuracy of predictions. Detailed implementations of this component are available in embodiment #4. 2. Second, generating prediction samples with fractional offset requires adjusting the generation of  prediction samples based on changes in the offset variable. This process ensures that the benefits of fractional precision are maintained throughout the prediction pipeline. The detailed implementation of this process is also documented in embodiment #4.

[0156] Solution #4: Total least squares regression for regression-based modes

[0157] This solution introduces total least squares (TLS) regression as an alternative to ordinary least squares regression. In TLS regression, the cost function measures residuals in both dependent and independent variables, providing a more comprehensive error assessment. The regression model selection and its parameters are informed by video coding information and the statistical characteristics of input data.

[0158] With reference to FIG. 18, the implementation consists of two primary procedures:

[0159] First, the system determines whether to employ total least squares regression based on video coding information and input data characteristics. TLS regression is particularly advantageous when the independent variable exhibits high noise levels. This scenario commonly occurs with luma samples in CCLM, gradient calculations in GLM, and reference block samples in LIC. The detailed criteria for this determination are documented in embodiment #7.

[0160] Second, the system computes slopes and offsets using the total least squares regression methodology. This computation process requires specialized handling of both dependent and independent variable residuals. The complete computational framework and implementation details are available in embodiments #5 and #6.

[0161] This systematic approach ensures that the regression model appropriately accounts for noise in all variables, potentially leading to more accurate predictions in video coding applications where both dependent and independent variables may contain significant noise.

[0162] Solution #5: Application scenarios of the innovation ideas

[0163] The invention may be used in various codecs, including proprietary ones, and standardized video coding solutions (e.g., MPEG / ISO / IEC, AOM, AVS) . In one or several embodiments, the solutions can be applied to a selected video codec. Combination of embodiments also can be applied into a selected video coding framework. The solution also can be used for multiple prediction modes: Table 2

[0164] Detailed information can be obtained from embodiment #8.

[0165] Embodiments of the disclosure are illustrated in the following.

[0166] Embodiment #1: Simplified integer arithmetic for slope computing

[0167] With reference to FIG. 6, an embodiment of a method of video encoding can be performed by an image encoder (e.g., the video encoding system 110) . The method of video encoding comprises: Step A001: receiving video signals of video frames; Step A002: using a linear model to perform prediction for a pixel in a video frame of the bitstream,  wherein coefficients of the linear model are obtained using integer arithmetic, and the integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation; Step A003: encoding the video frame to generate a coded video frame; and Step A004: transmitting a bitstream including the coded video frame.

[0168] With reference to FIG. 7, an embodiment of a method of video decoding can be performed by an image decoder (e.g., the video decoding system 120) . The method of video decoding comprises: Step A011: receiving a bitstream of coded video frames; and Step A012: using a linear model to perform prediction for a pixel in a coded video frame of the bitstream,  wherein coefficients of the linear model are obtained using integer arithmetic, and the integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation.

[0169] The technical features described below can be implemented in both video encoders and decoders.

[0170] In one or more embodiments of the disclosure, the linear model comprises a slope and an offset, wherein the slope is calculated from a numerator of the slope and a denominator of the slope; a first right shift value is used for right shifting of a numerator of the slope and a second right shift value  is used for right shifting of a denominator of the slope to control a dynamic range of data during calculation of the slope, wherein: the second right shift value is determined based on a position of a most significant bit (MSB) of  the denominator of the slope, and the first right shift value is obtained via value setting disregarding the numerator when satisfying  conditions related to at least one of: a bit depth of the video frame; a maximum number of input samples for the prediction; or a bit width of integer representation for arithmetic calculation; wherein value setting comprises setting the first right shift value equal to the second right shift value  or zero.

[0171] In one or more embodiments of the disclosure, the condition comprises: the second right shift value being greater than or equal to a threshold value, wherein the threshold value  is determined based on the bit depth of the video frame and a maximum number of input samples.

[0172] In one or more embodiments of the disclosure, the threshold value is calculated as: for Cross-Component Linear Model (CCLM) and Gradient Linear Model (GLM) : 3 times the bit depth, plus  minimum number of bits required to represent the maximum input sample count, minus 32; or for Local Illumination Compensation (LIC) : 2 times the bit depth, plus the minimum number of bits required  to represent the maximum input sample count, minus 16.

[0173] In one or more embodiments of the disclosure, the condition comprises: the bit depth being less than or equal to a predetermined bit depth and the maximum number of input  samples being less than or equal to a sample size.

[0174] In one or more embodiments of the disclosure, the method further comprises: determining whether an early escape condition is satisfied based on clipping requirements of the slope; and when the early escape condition is satisfied, clipping the slope according to a predetermined range of a  value of the slope without performing the calculation of the slope.

[0175] In one or more embodiments of the disclosure, for CCLM and GLM, the early escape condition comprises: determining whether an absolute value of the numerator is outside a range that is defined based on  d2, where d2 is the position of the MSB of an absolute value of the denominator; or for LIC, the early escape condition comprises: determining whether the absolute value of the numerator is outside a range that is defined based on  d2.

[0176] In one or more embodiments of the disclosure, the slope is clipped according to a first predetermined range for CCLM or GLM; or the slope is clipped according to a second predetermined range for LIC.

[0177] In one or more embodiments of the disclosure, the linear model is used in at least one of: Cross-Component Linear Model (CCLM) prediction; Gradient Linear Model (GLM) prediction; or Local Illumination Compensation (LIC) prediction.

[0178] This embodiment introduces an optimized approach for computing the slope using simplified integer arithmetic, consisting of two main improvements: 1. Computation Step Reduction: i、 Minimizes the number of most significant bit (MSB) counting operations. ii、 Reduces the required bit shifting operations. iii、 Streamlines the overall computation process. 2. Early Termination Logic: i、 Implements early escape conditions based on input sample analysis. ii、 Detects when values fall outside precision boundaries. iii、 Applies clipping configurations without full computation. iv、 Avoids unnecessary calculations when results can be predetermined

[0179] Reducing MSB counting and shifting operations

[0180] The conventional method for calculating the slope in linear regression consists of three primary computation steps: 1. Examine MSB of s2: Count the MSB of s2, determine the right shift value r2, and perform right shift on  s2; 2. Process MSB of s1: Count the MSB of s1, determine the right shift value r1, and perform right shift on  s1 3. Slope Generation: Perform integer multiplication and right shift S* bits to generate the slope a.

[0181] Counting the MSB is a recursive procedure and thus have long critical path. The following methods aim to determine the right shift values r1 and / or S* with simplified procedures.

[0182] The number of right shifts in the computation is determined by three key factors: 1. Image Bit Depth (D) : D represents the precision of pixel values. The image bit depth D is typically 8  or 10 in most image and video data. 2. Sample Size Parameters: The maximum number of input samples n or the number of bits to be  allocated which depends on the size of the coding unit. In most video coding systems,the maximum possible number of input samples is n≤512 and thus Dn≤9. 3. Architecture Bit Width: The maximum number of bits for the of a signed integer absolute value, which  is 31 in 32-bit arithmetic or 63 in 64-bit arithmetic.

[0183] The maximum number of bits used in the intermediate variables are shown in the following Table: Table 3

[0184] The intermediate variables can be implemented in different ways depending on the system architecture. The intermediate variables can be 32-bit or 64-bit integers in a software system, as mentioned before, and can be any bit size in dedicated hardware. Different conditions for simplified integer arithmetic are applied accordingly.

[0185] 32-bit arithmetic

[0186] To make sure the multiplication result does not exceed the dynamic range of a 32-bit signed integer, the maximum allowable bit depth for is m1=31- (D-1) =32-D in CCLM and GLM and m1=31-15=16 in LIC.

[0187] The embodiment provides overflow prevention using threshold-based shifting. Therefore, if the right shift value r1 is not less than a certain threshold Tr, data overflow would never happen when computing 1. In CCLM and GLM: Tr=2D+Dn-m1=3D+Dn-32             21 2. In LIC: Tr=2D+Dn-m1=2D+Dn-16             22

[0188] Dn is a number of bits representing maximum sample size.  represents the number of bits needed to be allocated. If r2≥Tr, set r1=r2, without counting the MSB of s1. Otherwise, the values of r1 and S* are determined using existing methods.

[0189] 64-bit arithmetic

[0190] To make sure the multiplication result does not exceed the dynamic range of a 64-bit signed integer, the maximum allowable bit depth for is m1=63- (D-1) =64-D in CCLM and GLM and m1=63-15=48 in LIC.

[0191] In video coding systems practically being in use, bit depth D is at most 12. To make sure that overflow would never happen, the condition for the sample size is: 2D+Dn≤48 or Dn≤24 or Dn is the number of bits needed to represent the sample size; n is the sample size. This upper limit of approximately 16.8 million samples is significantly higher than the dimensions of any coding units in a typical video coding system. Therefore, overflow virtually never happens. Both the counting of MSB of s1 and the bit shifting of s1 are skipped. This allows the calculations to be simplified to: r1=0                   24

[0192] An analysis of image bit depth, sample size and integer bit size

[0193] For a video coding system with dedicated hardware, the integer bit size (Di) can be a customized number other than 32 or 64 to accurately manage hardware manufacturing cost. The relation amongst image bit depth D, sample size and integer bit size Di where overflow never happens is: 2D+Dn≤m1=Di-1-15

[0194] Assuming a 12-bit internal image bit depth, the following table lists a few configurations for the integer bit size to be allocated to intermediate variable so that bit shifting of s1 is not needed. Table 4

[0195] Summary and comparison of algorithms

[0196] The detailed steps in this embodiment of the invention and in the prior arts are listed as follows: Table 5

[0197] A comparison of the number of operations in this embodiment of the invention and in the prior arts is as follows: Table 6

[0198] Early escape conditions determined by clipping requirements

[0199] In CCLM, GLM and LIC, due to the limitation of fractional bits and clipping on the slope, early escape is possible if the slope can be quickly determined to be outside the range of clipping.

[0200] Let d2 be the zero-indexed MSB of |s2|, which is already obtained as the intermediate result for obtaining r2:

[0201] The calculation is needed only if s1 falls inside the range where: 1. the slope is inside the clipping range (specified in section

[0100] ) ; and 2. the lowest fractional bit retained after rounding. If not, early escape is used.

[0202] CCLM and GLM Case:

[0203] In CCLM and GLM, as the slope is clipped to [-23, 23] and has at most 5 fractional bits, early escape is possible if |s1| is outside the range of · If meaning that a<-8 or a>8, the slop a is clipped to obtain a=-8 or a=8. · If |a|<2-5 and is rounded to zero.

[0204] The relationship between |s1 | and comes from how the slope α is calculated in linear regression: Where: s1 is the numerator (covariance-related term) s2 is the denominator (variance-related term) d2 is the MSB position of |s2|, meaning |s2| is approximately

[0205] To check if 1. This check helps determine if the slope will exceed the clipping range: i. For CCLM / GLM, slopes are clipped to [-8, 8] . ii. 8 = 23, so 3 bits are required for the integer part. iii. The extra 1 bit (+4 instead of +3) provides a safety margin. 2. The mathematical relationship: i. If ii. Then iii. This means |α| > 8 (exceeding the allowed range) .

[0206] LIC Case:

[0207] In LIC, as the slope is clipped to [0, 22] and has at most 5 fractional bits, early escape is possible if s1 is outside the range of · If implying a>4 (i.e.,  so that a>22) , the slop a is clipped to obtain a= 4. · If implying a<2-5, a is rounded or clipped to zero.

[0208] This comparison allows the encoder / decoder to skip the full division calculation when it can determine early that the result will need to be clipped anyway. This early escape mechanism helps optimize performance by avoiding unnecessary calculations when determining the final result based on the initial values.

[0209] Embodiment #2: Adaptive fractional bit depth allocation for the slope

[0210] With reference to FIG. 8, an embodiment of a method of video encoding can be performed by an image encoder (e.g., the video encoding system 110) . The method of video encoding comprises: Step B001: receiving video signals of video frames; Step B002: performing prediction for a pixel in a video frame of the bitstream using a linear model,  wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; Step B003: encoding the video frame to generate a coded video frame; and Step B004: transmitting a bitstream including the coded video frame; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an adaptive right shift value is calculated based on the multiplication result, wherein the adaptive right  shift value is determined based on a position of a most significant bit (MSB) of the multiplication result, and the adaptive right shift value is used to right shift the multiplication result to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted  multiplication result and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0211] With reference to FIG. 9, an embodiment of a method of video decoding can be performed by an image decoder (e.g., the video decoding system 120) . The method of video decoding comprises: Step B011: receiving a bitstream of coded video frames; and Step B012: performing prediction for a pixel in a coded video frame of the bitstream using a linear model,  wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an adaptive right shift value is calculated based on the multiplication result, wherein the adaptive right  shift value is determined based on a position of a most significant bit (MSB) of the multiplication result, and the adaptive right shift value is used to right shift the multiplication result to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted  multiplication result and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0212] The technical features described below can be implemented in both video encoders and decoders.

[0213] In one or more embodiments of the disclosure, the final shift value is determined based on a precision of the linear model.

[0214] In one or more embodiments of the disclosure, the adaptive right shift value is determined based on a number X, the X defines a number of significant bits of the slope.

[0215] In one or more embodiments of the disclosure, the slope is used in at least one of: a cross-component linear model prediction mode; a gradient linear model prediction mode; or a local illumination compensation prediction mode.

[0216] This embodiment introduces a least squares regression method that uses adaptive bit depth allocation. The method builds upon the general integer arithmetic procedures for least squares regression that were described in section

[0093] , but adds dynamic bit depth allocation capabilities.

[0217] As shown in FIG. 19, α is the actual fractional slope value, a is the integer representation of α. The calculation proceeds in three steps:

[0218] Operation A1: Obtaining

[0219] Operation A2: Performing a right shift to obtain a value for the slope a (i.e., an initial value of a) , and

[0220] Operation A3: Performing a left shift to put the MSB to the 5th least significant bit under zero-based indexing.

[0221] However, this process leaves some least significant bits unused. To prevent loss of significant bits from right shift overshoot when calculating a, the following procedures for calculating a is applied. The right shift value S* is recalculated based on the multiplication result Specifically, the embodiment of the disclosure comprises: Operation A4: Recalculating right shift value S* based on the multiplication result

[0222] When compared with traditional method where S*= A -5 + r2 -r1, and A is typically D + 4 for CCLM / GLM or 15 for LIC (i.e., fixed approach) , this new approach allows for more dynamic and precise bit allocation.

[0223] Based on the scale of the slope a is always truncated to retain X+1 significant bits. To align with the methods in the existing video coding standards, X can be set to 5.

[0224] The shift value S is recalculated since S* is changed. Let F (x) represent the zero-indexed position of unit place digit of x:

[0225] The embodiment provides a method of adaptive fractional bit depth allocation comprising the following steps:

[0226] Step 1: Initial calculation: Obtain the multiplication result:

[0227] Step 2: Calculate adaptive right shift: Calculate Where X = 5 (to match video coding standards) ; This ensures to retain X + 1 = 6 significant bits in the slope.

[0228] Step 3: Apply right shift to get slope: Calculate a by right-shifting the multiplication result by S*bits

[0229] Step 4: Calculate final shift value: Calculate S using S*.

[0230] The new formula for S*differs from the traditional method by calculating the shift amount dynamically based on the actual value of using to determine the appropriate shift amount, subtracting X (set to 5) to maintain desired precision, and incorporating a max (0, . . . ) operation to prevent negative shifts from occurring.

[0231] The primary goal of this method is to optimize bit depth allocation in video coding calculations, particularly for regression coefficients. It does this by carefully managing how numerical values are processed and stored.

[0232] When performing calculations in video coding, the embodiment to preserves as much numerical precision as possible while working within the constraints of fixed-bit representations. This method specifically prevents the loss of significant bits that can occur during right shift operations -a common problem in traditional implementations.

[0233] The approach maintains backward compatibility with existing video coding standards while introducing smarter bit allocation. Rather than using fixed bit depths, it adapts the allocation based on the actual values being processed. This dynamic approach allows for more efficient use of the available bits.

[0234] For example, when dealing with small coefficients, more bits can be allocated to represent fractional components. Conversely, when handling larger values, the method ensures enough bits are available for the integer portion while still maintaining reasonable precision for fractions.

[0235] By analyzing the scale and characteristics of the values being processed, the method maximizes the achievable precision within the limited number of bits available. This results in more accurate calculations while staying within the memory and computational constraints of video coding systems.

[0236] This method improves upon fixed bit allocation approaches by dynamically adjusting the bit allocation based on the actual values being processed, while still maintaining compatibility with existing standards.

[0237] Embodiment #3: Adaptive fractional bit allocation for the slope with non-zero mean prior

[0238] With reference to FIG. 10, an embodiment of a method of video encoding can be performed by an image encoder (e.g., the video encoding system 110) . The method of video encoding comprises: Step C001: receiving video signals of video frames; Step C002: performing prediction for a pixel in a video frame of the bitstream using a linear regression  model, wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; Step C003: encoding the video frame to generate a coded video frame; and Step C004: transmitting a bitstream including the coded video frame; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of a second shifted value of the denominator; an expected slope value is obtained based on prior knowledge of a prediction mode; an adaptive right shift value is calculated based on a difference between the multiplication result and  the expected slope value, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the difference, and the adaptive right shift value is used to right shift the difference to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted difference  and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0239] With reference to FIG. 11, an embodiment of a method of video decoding can be performed by an image decoder (e.g., the video decoding system 120) . The method of video decoding comprises: Step C011: receiving a bitstream of coded video frames; and Step C012: performing prediction for a pixel in a coded video frame of the bitstream using a linear  regression model, wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator; wherein for the linear model, a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of  a second shifted value of the denominator; an expected slope value is obtained based on prior knowledge of a prediction mode; an adaptive right shift value is calculated based on a difference between the multiplication result and  the expected slope value, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the difference, and the adaptive right shift value is used to right shift the difference to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; and a final shift value is calculated for right shifting a temporary value obtained from the right shifted  difference and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.

[0240] The technical features described below can be implemented in both video encoders and decoders.

[0241] In one or more embodiments of the disclosure, the final shift value is determined based on a precision of the linear model.

[0242] In one or more embodiments of the disclosure, the adaptive right shift value is determined based on a number X, the X defines a number of significant bits of the slope.

[0243] In one or more embodiments of the disclosure, the slope is used in at least one of: a cross-component linear model prediction mode; a gradient linear model prediction mode; or a local illumination compensation prediction mode.

[0244] This embodiment introduces a specialized approach for handling cases where the slope is expected to have a non-zero value based on prior information. Traditional fractional bit allocation typically assumes a zero-centered slope distribution to maximize the number of available fractional bits. However, in many practical scenarios, the encode and / or decoder knows in advance that the slope will likely be centered around a non-zero value.

[0245] To handle these cases more effectively, this method first subtracts the expected non-zero value from the computation results. By centering the values around zero in this way, the encode and / or decoder can make more efficient use of the available bits for representing fractional values. The bit shift operations are then determined based on this zero-centered result rather than the raw values.

[0246] For example, if prior information suggests that slopes tend to cluster around 1.0, subtracting this expected value before bit allocation allows the encode and / or decoder to represent small variations around 1.0 with higher precision than would be possible with a standard zero-centered approach. The bit shift is chosen based on the zero-centred slope. The formula for this process can be expressed as: where Ea represents an expected value of the slope.

[0247] The expected value Ea of the slope is subtracted from the computation results

[0248] When prior knowledge about the expected slope value is available, the encoder and / or decoder can optimize bit allocation by accounting for this information. Taking Local Illumination Compensation (LIC) as a practical example, the expected slope typically centers around 1, representing scenarios with minimal illumination changes between reference and current blocks.

[0249] To leverage this knowledge, the encoder and / or decoder first performs a bit shift adjustment: the expected value of 1 is shifted left by (A + r2 -r1) bits to match the scale of the computation results. This process can be expressed mathematically as: Ea=1<< (A+r2-r1)                 31

[0250] where Ea represents the shifted expected value that will be subtracted from the computation results.

[0251] As another example, the expected slope value is obtained from a collection of neighboring coded blocks or using historical values of recent likewise-coded blocks. If such blocks are coded in the same coding mode as the current block, the stored slope in historical data can be used as a prior knowledge of the expected slope.

[0252] This shifted value is then subtracted from the intermediate calculations before determining the final bit allocation. This approach enables more precise representation of small variations around the expected slope of 1, compared to allocating bits with a zero-centered distribution assumption.

[0253] The method for adaptive fractional bit allocation with non-zero mean prior includes the following steps:

[0254] Step 1 -Initialization: The adaptive fractional bit allocation method with non-zero mean prior begins with an initialization phase. The encoder and / or decoder first obtains the expected slope value (Ea) based on the specific coding mode being used. For the LIC mode, Ea is set to 1, while for other modes, Ea is determined through statistical analysis or based on the characteristics of the particular mode.

[0255] Step 2 -Scale Adjustment: After initialization, the method proceeds with scale adjustment. The encoder and / or decoder calculates the bit shift parameters A, r1, and r2 based on the input data ranges. To match the computation scale, a left shift operation is performed on Ea by (A + r2 -r1) bits, resulting in Ea_scaled = Ea << (A + r2 -r1) .

[0256] Step 3 -Zero-Centering: The next phase involves zero-centering the values. The scaled expected value is subtracted from the intermediate computation results of the slope to obtain zero_centered_value = -Ea_scaled. This step helps center the values around zero for more efficient bit allocation.

[0257] Step 4 -Bit Shift Determination: For bit shift determination, the encoder and / or decoder calculates the required bit shift based on the zero-centered value using the formula where X determines the number of significant bits to retain in the final result.

[0258] Step 5 -Final Slope Calculation: The method concludes with the final slope calculation. The calculated bit shift is applied to obtain the final slope value, with any necessary clipping or rounding operations performed. Finally, the shift value S is updated for use in subsequent prediction calculations. This last step ensures the calculated values maintain proper scaling for further processing in the video coding pipeline.

[0259] This method enables the encoder and / or decoder to maintain higher precision when the actual slope values cluster around a known non-zero value, while staying within the constraints of fixed-point arithmetic used in video coding systems.

[0260] Embodiment #4: Fractional precision for the offset

[0261] With reference to FIG. 12, an embodiment of a method of video encoding can be performed by an image encoder (e.g., the video encoding system 110) . The method of video encoding comprises: Step D001: receiving video signals of video frames; Step D002: performing prediction for a pixel in a video frame of the bitstream using a linear model,  wherein the linear model comprises a slope and an offset with fractional precision; Step D003: encoding the video frame to generate a coded video frame; and Step D004: transmitting a bitstream including the coded video frame; wherein rounding an output of the linear model to integer precision is performed after calculating the  linear model with the slope and offset; and wherein for the offset with fractional precision a first term is obtained by left shifting a mean value of dependent variable samples by a first shift value; a second term is obtained by multiplying the slope with a mean value of independent variable samples; and the offset value is a difference between the first term and the second term.

[0262] With reference to FIG. 13, an embodiment of a method of video decoding can be performed by an image decoder (e.g., the video decoding system 120) . The method of video decoding comprises: Step D011: receiving a bitstream of coded video frames; and Step D012: performing prediction for a pixel in a coded video frame of the bitstream using a linear  model, wherein the linear model comprises a slope and an offset with fractional precision; wherein rounding an output of the linear model to integer precision is performed after calculating the  linear model with the slope and offset; and wherein for the offset with fractional precision a first term is obtained by left shifting a mean value of dependent variable samples by a first shift value; a second term is obtained by multiplying the slope with a mean value of independent variable samples; and the offset value is a difference between the first term and the second term.

[0263] The technical features described below can be implemented in both video encoders and decoders.

[0264] In one or more embodiments of the disclosure, the first shift value is the same with a second shift value applied to the slope.

[0265] In one or more embodiments of the disclosure, the first shift value is different from a second shift value applied to the slope.

[0266] This embodiment introduces a method for maintaining fractional precision in the offset value during regression calculations. Unlike traditional approaches that round the offset to integer values, this method preserves fractional bits in both slope and offset calculations, leading to more accurate predictions.

[0267] The method can be implemented in two different ways:

[0268] First approach-Using the same shift value for slope and offset:

[0269] The first approach applies the same shift value to both slope and offset calculations. During regression, the offset is computed as:

[0270] When generating predictions, instead of rounding after each operation, the method delays rounding until all calculations are complete. The prediction formula becomes: ypred= (a·x+b) >>S                33

[0271] Second approach-Using separate shift values for slope and offset:

[0272] The second approach uses separate shift values for slope and offset, providing more flexibility. This requires extending the coefficient data structure to include four parameters {a, b, S, So} , where So is the shift value specific to the offset. Generally, So is kept less than or equal to S since any additional fractional bits would be lost in the final rounding. Under this approach, the offset is computed as:

[0273] The corresponding prediction formula becomes: ypred= (a·x+b<< (S-So) ) >>S             35

[0274] By maintaining fractional precision in the offset calculations, the encoder and / or decoder can reduce rounding errors when evaluating mean values of input samples. This leads to more accurate predictions while requiring minimal additional computational complexity since the fractional precision is handled through existing shift operations.

[0275] Setup and Parameter Selection:

[0276] In some embodiments, the encoder and / or decoder determines whether to use single or dual shift values. For single shift implementation, only S is needed. For dual shift implementation, both S and So values are determined, with So ≤ S to prevent precision loss.

[0277] The method for maintaining fractional precision in offset calculations can be implemented through the following steps:

[0278] Regarding offset computation: 1. For single shift implementation, the encoder and / or decoder computes the offset using formula 32: 2. For dual shift implementation, the offset is computed using formula 34.

[0279] Regarding prediction generation: 1. For single shift implementation, the encoder and / or decoder calculates predictions using formula 33. 2. For dual shift implementation, the encoder and / or decoder calculates predictions using formula 35.

[0280] The encoder and / or decoder performs rounding only at the final step of prediction generation, maintaining fractional precision throughout intermediate calculations. This ensures maximum precision in the final predicted values while staying within the constraints of integer arithmetic.

[0281] This method allows for more accurate predictions by preserving fractional precision in both slope and offset calculations until the final output stage.

[0282] Embodiment #5: Using total least squares regression in regression-based modes

[0283] With reference to FIG. 14, an embodiment of a method of video encoding can be performed by an image encoder (e.g., the video encoding system 110) . The method of video encoding comprises: Step E001: receiving video signals of video frames; Step E002: calculating a slope and an offset in a total least squares regression model of which both  the independent variable and dependent variable contain errors; Step E003: performing prediction for a pixel in a video frame of the bitstream using the total least  squares regression model, wherein performing prediction using the total least squares regression model comprises integer arithmetic procedures for a numerator of the slope and a denominator of the slope; Step E004: encoding the video frame to generate a coded video frame; and Step E005: transmitting a bitstream including the coded video frame.

[0284] With reference to FIG. 15, an embodiment of a method of video decoding can be performed by an image decoder (e.g., the video decoding system 120) . The method of video decoding comprises: Step E011: receiving a bitstream of coded video frames; Step E012: calculating a slope and an offset in a total least squares regression model of which  both the independent variable and dependent variable contain errors; and Step E013: performing prediction for a pixel in a coded video frame of the bitstream using the  total least squares regression model; wherein performing prediction using the total least squares regression model comprises integer arithmetic  procedures for a numerator of the slope and a denominator of the slope.

[0285] The technical features described below can be implemented in both video encoders and decoders.

[0286] In one or more embodiments of the disclosure, the method further comprises: determining whether to use the total least squares regression model or an ordinary least squares regression  model based on at least one of: comparing a number of input samples to a first threshold; comparing an average value of independent variable samples to a second threshold; or comparing a quantization parameter to a third threshold.

[0287] This embodiment introduces total least squares (TLS) regression as an alternative to the traditional ordinary least squares (OLS) regression method used in video coding. Unlike OLS regression, which only considers errors in the dependent variable, TLS regression accounts for observational errors in both dependent and independent variables. This makes it particularly suitable for video coding applications where both variables may contain quantization errors or noise.

[0288] A key advantage of this embodiment is that it can utilize the same integer arithmetic infrastructure already implemented for OLS regression in existing video coding systems. This means the encoder and / or decoder can implement TLS regression while maintaining computational efficiency and hardware compatibility with current systems. The method provides more accurate predictions in scenarios where both variables contain significant measurement errors, while leveraging existing arithmetic implementations.

[0289] Total least squares regression for CCLM, GLM and LIC:

[0290] When applying total least squares regression to Cross-Component Linear Model (CCLM) , Gradient Linear Model (GLM) , and Local Illumination Compensation (LIC) , the regression can be simplified because these modes each involve only one independent variable. In such cases, TLS regression takes the form of Deming regression -a specialized variant designed for scenarios with one independent and one dependent variable, each affected by independent observation or measurement noise.

[0291] The Deming regression solution can be derived starting with a basic linear regression equation that includes a slope and offset. In a linear regression problem with a slope and an offset: y=α·x+β                  36

[0292] In this model, for input samples (xi, yi) , both the independent variable (xi) and dependent variable (yi) contain errors. The observed values can be expressed in terms of their true values ( and ) plus noise terms (ηi and ∈i) :

[0293] Where and are the true values behind observed values xi , and yi and ηi and ∈i are their corresponding noise. The goal of Deming regression is to minimize a weighted sum of squared residuals that accounts for errors in both variables. This objective function can be expressed as: Where and are the estimated variance of ∈i and ηi.

[0294] There is an analytical solution to the Deming regression: Where is the sum of squared xi values; is the sum of squared yi values; is the sum of xiyi products; represents the ratio of variances between yi and xi errors; and are the sample mean of x and y respectively.

[0295] The full derivation of this solution can be found in A. C. Jensen, Deming regression, MethComp package, Gentofte, Denmark: Steno Diabetes Center, May. 2007.

[0296] Implementation with integer arithmetic

[0297] The solution to slope α in Deming regression is a ratio between two quantities, which resembles the scenarios in OLS regression in section

[0100] . Either existing integer arithmetic as in section

[0100] or the methods in sections

[0167] ,

[0210] ,

[0238] ,

[0261] can be used for obtaining model coefficients {a, b, S} with the following definition of variables: s2=2sxy                   42

[0298] The square root can be obtained using Newton’s method. The following is an example of solving for the square root of an unsigned 64-bit integer using Newton’s method. Table 7

[0299] The embodiment provides a method using total least squares regression implementation for video coding. In an embodiment, the method comprises the following steps:

[0300] Step 1: Initial Setup

[0301] First, confirm that the coding mode uses linear regression (such as CCLM, GLM, or LIC) and involves one independent and one dependent variable. The method assumes both variables contain measurement or reconstruction noise. Set up the basic linear model y = αx + β, where each observed value contains a true component and a noise component:  for the independent variable and ∈i for the dependent variable.

[0302] Step 2: Statistical Calculations

[0303] Begin by calculating the fundamental statistics needed for the regression. Compute the sum of squared x values the sum of squared y values and the sum of x-y products  Additionally, calculate the mean values and for both variables. These statistics form the foundation for the regression calculations.

[0304] Step 3: Slope Calculation

[0305] Calculate the slope coefficient (α) using the Deming regression formula. The calculation involves two main components: the numerator and the denominator s2 =2sxy. The ratio δ represents the relative noise variances between variables. The final slope is obtained by dividing s1 by s2.

[0306] Step 4: Offset Calculation

[0307] After obtaining the slope, calculate the offset coefficient (β) using the formula This ensures the regression line passes through the point defined by the means of the variables, maintaining the proper relationship between the variables.

[0308] Step 5: Integer Arithmetic Implementation

[0309] Convert the floating-point calculations to integer arithmetic suitable for video coding applications. Use either existing integer arithmetic methods or the improved precision methods from previous embodiments. Define integer representations for s1 and s2, and convert the final coefficients to the standard format {a, b, S} used in video coding.

[0310] Step 6: Square Root Computation

[0311] Implement the square root calculation required in the slope formula using Newton's method. Start with an initial estimate equal to the input value, then iteratively refine it using the formula y = (x + n / x) >> 1 until convergence, an escape condition is met, or a maximum number of iterations is exceeded. The maximum number of iterations may be preset or predetermined. This provides an efficient integer-based approximation of the square root.

[0312] Step 7: Final Processing

[0313] Complete the implementation by applying any necessary post-processing steps. This includes clipping values to valid ranges, ensuring proper bit depth compliance, and formatting the coefficients according to codec specifications. The final output should be ready for use in the video coding prediction unit.

[0314] This method can be integrated into existing video coding frameworks as part of the decoder's prediction unit. The choice between this total least squares approach and standard ordinary least squares regression should be based on the conditions specified in the implementation guidelines, particularly concerning noise levels and sample characteristics.

[0315] Embodiment #6: Estimating the ratio of noise levels in total least squares regression.

[0316] In total least squares regression, a ratio between the mean squared noise of the dependent variable and the noise level of the independent variable is a parameter estimated from input samples or coded information and an unknown prior.

[0317] Method 1: Component-Based Fixed Ratio for CCLM and GLM For Cross-Component Linear Model (CCLM) and Gradient Linear Model (GLM) , the noise characteristics differ between luma and chroma components. Based on empirical observations that chroma components typically have smaller quantization errors than luma components, the encoder and / or decoder can set a fixed ratio: δ=0.5                    43

[0318] Method 2: Equal Noise Assumption for LIC

[0319] For Local Illumination Compensation (LIC) , where both reference and current blocks are from the same component, the encoder and / or the decoder can assume similar noise levels in both blocks. For example, in LIC, the expected quantization errors in the reference block and the current block are assumed to be of similar noise level. δ=1                    44

[0320] Method 3: QP-Based Dynamic Ratio:

[0321] This method estimates the ratio based on the quantization parameters (QP) or colour components of the reference and current blocks or components. The relationship follows the observation that in ECM, a QP increase of 5 corresponds to a 3dB peak signal-to-noise ratio (PSNR) decrease, equivalent to doubling the mean squared reconstruction errors. The ratio is calculated as: Where QPcur is the QP of the current block / component; QPref is the QP of the reference block / component.

[0322] Method 4: Camera Parameter-Based Estimation:

[0323] When camera parameters are available, the encoder and / or decoder can estimate the ratio using imaging characteristics such as: 1. Dynamic range settings; 2. Analog-to-digital conversion parameters; 3. Dark noise levels; 4. Shot noise characteristics.

[0324] The relative noise levels across different components or blocks can be derived from these camera configuration parameters, providing a more accurate estimate of the noise ratio.

[0325] Embodiment #7: Conditions on using total least squares regression over existing methods

[0326] This embodiment specifies the conditions under which total least squares (TLS) regression should be selected over ordinary least squares (OLS) regression in video coding applications. The selection is made on the decoder side based on quantifiable characteristics of the input data and coding parameters.

[0327] Primary Selection Factors:

[0328] The decoder evaluates three main factors when determining whether to use TLS regression: 1. Sample Size Impact: A smaller number of input samples typically results in stronger noise presence. The sample size is directly related to the block size and the availability of neighboring coded samples in the template area. 2. Illumination Level Effect: Lower overall illumination levels in the independent variable tend to produce stronger noise. The decoder measures this through the average luma values in the input samples. 3. Quantization Impact: Higher quantization parameters lead to increased reconstruction errors in the  samples, making TLS more appropriate.

[0329] It is thus desirable to use TLS regression over existing methods such as OLS regression if at least one of the followings is satisfied: 1. The number of input samples is lower than a certain threshold n<Tn; 2. The average value of the independent variable is lower than a certain threshold sxx / n<Tx; 3. The quantization parameter is larger than a certain value QP>TQ. Where n is the number of available input samples; Tn is a predefined threshold for minimum sample size; sxx is the sum of squared x values; Tx is a predefined threshold for average intensity; QP is the quantization parameter; TQ is a predefined threshold for quantization.

[0330] Embodiment #8: Application scenarios for simplified integer arithmetic, adaptive fractional bit allocation and total least squares regression for regression-based modes

[0331] This embodiment defines the scope and applicability of three enhanced regression methods: simplified integer arithmetic, adaptive fractional bit allocation, and total least squares regression. These methods can be applied independently or in combination within video coding frameworks.

[0332] Qualifying Coding Modes:

[0333] A coding mode qualifies for these enhanced methods when it meets at least one of the following criteria: 1. Prediction Block Generation: The mode must generate prediction blocks using linear model  coefficients obtained through regression analysis. 2. Coefficient Structure: The linear model must utilize exactly two coefficients where: i. The first coefficient multiplies the input variable; and ii. The second coefficient adds to the multiplication result. 3. Implementation Requirement: The mode must implement linear regression using integer arithmetic.

[0334] Applicable Coding Tools: The enhanced methods can be applied to at least the following coding tools: 1. Cross-Component Linear Model (CCLM) i. Including the base CCLM mode ii. Including all CCLM variants iii. Including multi-model CCLM implementations 2. Local Illumination Compensation (LIC) iv. Including the base LIC mode v. Including multi-model LIC implementations

[0335] Implementation Flexibility The encoder and / or decoder can implement these enhancements with the following characteristics: 1. Each method can be enabled or disabled independently; 2. Methods can be combined in any configuration; 3. Implementation can be selective based on coding mode.

[0336] By defining clear applicability criteria and supported coding tools, this embodiment ensures proper integration of the enhanced regression methods into existing video coding frameworks while maintaining flexibility in implementation.

[0337] With reference to FIG. 20, the embodiment of the disclosure also provides a chip 70 that may correspond to an encoder in the embodiments of the disclosure. The chip 70 may implement a corresponding process realized by the encoder (i.e., video encoding system 110) in various methods of the embodiments of the disclosure. The chip 70 includes a processor 71, and the processor 71 may call and run a computer program from memory to implement the methods in the embodiments of the present application.

[0338] Optionally, the chip 70 may also include a memory 72. In particular, the processor 71 may call and run the computer program from the memory 72 to implement the methods in the embodiments of the present application.

[0339] Moreover, the memory 72 may be a separate device from the processor 71 or may be integrated into the processor 71.

[0340] Optionally, the chip 70 may further include an input interface 73. Note that the processor 71 may control the input interface 73 to communicate with other devices or chips, specifically, to obtain messages or data sent by other devices or chips.

[0341] Optionally, the chip 70 may further include an output interface 74. Note that the processor 71 may control the output interface 74 to communicate with other devices or chips, specifically, to output messages or data to other devices or chips.

[0342] With reference to FIG. 21, the embodiment of the disclosure also provides another chip 80 that may correspond to a decoder (i.e., video decoding system 120) in the description, and the chip 80 may implement the corresponding processes implemented by the decoder in the various methods of the embodiments of the disclosure. The chip 80 includes a processor 81, and the processor 81 may call and run a computer program from the memory 82 to implement the methods in the embodiments of the present application.

[0343] Optionally, the chip 80 may further include a memory 82. In particular, the processor 81 may call and run the computer program from the memory 82 to implement the methods in the embodiments of the present application.

[0344] Wherein the memory 82 may be a separate device from the processor 81 or may be integrated into the processor 81.

[0345] Optionally, the chip 80 may also include an input interface 83. In particular, the processor 81 may control the input interface 83 to communicate with other devices or chips, specifically, to obtain messages or data sent by other devices or chips.

[0346] Optionally, the chip may further include an output interface 84. In particular, the processor 81 may control the output interface 84 to communicate with other devices or chips, specifically, to output messages or data to other devices or chips.

[0347] The disclosed method may be programmed as computer executable instructions stored in non-transitory computer readable medium. The non-transitory computer readable medium, when loaded to a computer, directs a processor of the computer to execute the disclosed method.

[0348] The non-transitory computer readable medium may comprise at least one from a group consisting of:a hard disk, a CD-ROM, an optical storage device, a magnetic storage device, a Read Only Memory, a Programmable Read Only Memory, an Erasable Programmable Read Only Memory, EPROM, an Electrically Erasable Programmable Read Only Memory and a Flash memory.

[0349] The disclosed method may be programmed as a computer program product that causes a computer to execute the disclosed method.

[0350] The disclosed method may be programmed as a computer program that causes a computer to execute the disclosed method.

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

Claims

A method of video decoding comprising:receiving a bitstream of coded video frames; andusing a linear model to perform prediction for a pixel in a coded video frame of the bitstream, wherein coefficients of the linear model are obtained using integer arithmetic, and the integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation.The method of claim 1, wherein the linear model comprises a slope and an offset, wherein the slope is calculated from a numerator of the slope and a denominator of the slope;a first right shift value is used for right shifting of a numerator of the slope and a second right shift value is used for right shifting of a denominator of the slope to control a dynamic range of data during calculation of the slope, wherein:the second right shift value is determined based on a position of a most significant bit (MSB) of the denominator of the slope, andthe first right shift value is obtained via value setting disregarding the numerator when satisfying conditions related to at least one of:a bit depth of the video frame;a maximum number of input samples for the prediction; ora bit width of integer representation for arithmetic calculation;wherein value setting comprises setting the first right shift value equal to the second right shift value or zero.The method of claim 2, wherein the condition comprises:the second right shift value being greater than or equal to a threshold value, wherein the threshold value is determined based on the bit depth of the video frame and a maximum number of input samples.The method of claim 3, wherein the threshold value is calculated as:for Cross-Component Linear Model (CCLM) and Gradient Linear Model (GLM) : 3 times the bit depth, plus minimum number of bits required to represent the maximum input sample count, minus 32; orfor Local Illumination Compensation (LIC) : 2 times the bit depth, plus the minimum number of bits required to represent the maximum input sample count, minus 16.The method of claim 2, wherein the condition comprises:the bit depth being less than or equal to a predetermined bit depth and the maximum number of input samples being less than or equal to a sample size.The method of claim 2, further comprising:determining whether an early escape condition is satisfied based on clipping requirements of the slope; andwhen the early escape condition is satisfied, clipping the slope according to a predetermined range of a value of the slope without performing the calculation of the slope.The method of claim 6, wherein for CCLM and GLM, the early escape condition comprises:determining whether an absolute value of the numerator is outside a range that is defined based on d2, where d2 is the position of the MSB of an absolute value of the denominator; orfor LIC, the early escape condition comprises:determining whether the absolute value of the numerator is outside a range that is defined based on d2.The method of claim 6, wherein the slope is clipped according to a first predetermined range for CCLM or GLM; orthe slope is clipped according to a second predetermined range for LIC.The method of claim 2, wherein the linear model is used in at least one of:Cross-Component Linear Model (CCLM) prediction;Gradient Linear Model (GLM) prediction; orLocal Illumination Compensation (LIC) prediction.A method of video decoding comprising:receiving a bitstream of coded video frames; andperforming prediction for a pixel in a coded video frame of the bitstream using a linear model, wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator;wherein for the linear model,a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of a second shifted value of the denominator;an adaptive right shift value is calculated based on the multiplication result, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the multiplication result, and the adaptive right shift value is used to right shift the multiplication result to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; anda final shift value is calculated for right shifting a temporary value obtained from the right shifted multiplication result and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.The method of claim 10, wherein the final shift value is determined based on a precision of the linear model.The method of claim 10, wherein the adaptive right shift value is determined based on a number X, the X defines a number of significant bits of the slope.The method of claim 10, wherein the slope is used in at least one of:a cross-component linear model prediction mode;a gradient linear model prediction mode; ora local illumination compensation prediction mode.A method of video decoding comprising:receiving a bitstream of coded video frames; andperforming prediction for a pixel in a coded video frame of the bitstream using a linear regression model, wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator;wherein for the linear model,a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of a second shifted value of the denominator;an expected slope value is obtained based on prior knowledge of a prediction mode;an adaptive right shift value is calculated based on a difference between the multiplication result and the expected slope value, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the difference, and the adaptive right shift value is used to right shift the difference to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; anda final shift value is calculated for right shifting a temporary value obtained from the right shifted difference and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.The method of claim 14, wherein the final shift value is determined based on a precision of the linear model.The method of claim 14, wherein the adaptive right shift value is determined based on a number X, the X defines a number of significant bits of the slope.The method of claim 14, wherein the slope is used in at least one of:a cross-component linear model prediction mode;a gradient linear model prediction mode; ora local illumination compensation prediction mode.A method of video decoding comprising:receiving a bitstream of coded video frames; andperforming prediction for a pixel in a coded video frame of the bitstream using a linear model, wherein the linear model comprises a slope and an offset with fractional precision;wherein rounding an output of the linear model to integer precision is performed after calculating the linear model with the slope and offset; andwherein for the offset with fractional precisiona first term is obtained by left shifting a mean value of dependent variable samples by a first shift value;a second term is obtained by multiplying the slope with a mean value of independent variable samples; andthe offset value is a difference between the first term and the second term.The method of claim 18, wherein the first shift value is the same with a second shift value applied to the slope.The method of claim 18, wherein the first shift value is different from a second shift value applied to the slope.A method of video decoding comprising:receiving a bitstream of coded video frames;calculating a slope and an offset in a total least squares regression model of which both the independent variable and dependent variable contain errors; andperforming prediction for a pixel in a coded video frame of the bitstream using the total least squares regression model;wherein performing prediction using the total least squares regression model comprises integer arithmetic procedures for a numerator of the slope and a denominator of the slope.The method of claim 21, further comprising:determining whether to use the total least squares regression model or an ordinary least squares regression model based on at least one of:comparing a number of input samples to a first threshold;comparing an average value of independent variable samples to a second threshold; orcomparing a quantization parameter to a third threshold.A decoder comprising:a processor configured to call and run a computer program stored in a memory, to cause a device in which the processor is installed to execute the method of any of claims 1 to 22.A chip, comprising:a processor, configured to call and run a computer program stored in a memory, to cause a device in which the chip is installed to execute the method of any of claims 1 to 22.A computer-readable storage medium, in which a computer program is stored, wherein the computer program causes a computer to execute the method of any of claims 1 to 22.A computer program product, comprising a computer program, wherein the computer program causes a computer to execute the method of any of claims 1 to 22.A computer program, wherein the computer program causes a computer to execute the method of any of claims 1 to 22.A method of video decoding comprising:receiving video signals of video frames;using a linear model to perform prediction for a pixel in a video frame of the bitstream, wherein coefficients of the linear model are obtained using integer arithmetic, and the integer arithmetic includes at least one condition to bypass at least one shift operation or at least one early escape condition to skip a linear regression calculation;encoding the video frame to generate a coded video frame; andtransmitting a bitstream including the coded video frame.The method of claim 28, wherein the linear model comprises a slope and an offset, wherein the slope is calculated from a numerator of the slope and a denominator of the slope;a first right shift value is used for right shifting of a numerator of the slope and a second right shift value is used for right shifting of a denominator of the slope to control a dynamic range of data during calculation of the slope, wherein:the second right shift value is determined based on a position of a most significant bit (MSB) of the denominator of the slope, andthe first right shift value is obtained via value setting disregarding the numerator when satisfying conditions related to at least one of:a bit depth of the video frame;a maximum number of input samples for the prediction; ora bit width of integer representation for arithmetic calculation;wherein value setting comprises setting the first right shift value equal to the second right shift value or zero.The method of claim 29, wherein the condition comprises:the second right shift value being greater than or equal to a threshold value, wherein the threshold value is determined based on the bit depth of the video frame and a maximum number of input samples.The method of claim 30, wherein the threshold value is calculated as:for Cross-Component Linear Model (CCLM) and Gradient Linear Model (GLM) : 3 times the bit depth, plus minimum number of bits required to represent the maximum input sample count, minus 32; orfor Local Illumination Compensation (LIC) : 2 times the bit depth, plus the minimum number of bits required to represent the maximum input sample count, minus 16.The method of claim 29, wherein the condition comprises:the bit depth being less than or equal to a predetermined bit depth and the maximum number of input samples being less than or equal to a sample size.The method of claim 29, further comprising:determining whether an early escape condition is satisfied based on clipping requirements of the slope; andwhen the early escape condition is satisfied, clipping the slope according to a predetermined range of a value of the slope without performing the calculation of the slope.The method of claim 33, wherein for CCLM and GLM, the early escape condition comprises:determining whether an absolute value of the numerator is outside a range that is defined based on d2, where d2 is the position of the MSB of an absolute value of the denominator; orfor LIC, the early escape condition comprises:determining whether the absolute value of the numerator is outside a range that is defined based on d2.The method of claim 33, wherein the slope is clipped according to a first predetermined range for CCLM or GLM; orthe slope is clipped according to a second predetermined range for LIC.The method of claim 29, wherein the linear model is used in at least one of:Cross-Component Linear Model (CCLM) prediction;Gradient Linear Model (GLM) prediction; orLocal Illumination Compensation (LIC) prediction.A method of video encoding comprising:receiving video signals of video frames;performing prediction for a pixel in a video frame of the bitstream using a linear model, wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator;encoding the video frame to generate a coded video frame; andtransmitting a bitstream including the coded video frame;wherein for the linear model,a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of a second shifted value of the denominator;an adaptive right shift value is calculated based on the multiplication result, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the multiplication result, and the adaptive right shift value is used to right shift the multiplication result to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; anda final shift value is calculated for right shifting a temporary value obtained from the right shifted multiplication result and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.The method of claim 37, wherein the final shift value is determined based on a precision of the linear model.The method of claim 37, wherein the adaptive right shift value is determined based on a number X, the X defines a number of significant bits of the slope.The method of claim 37, wherein the slope is used in at least one of:a cross-component linear model prediction mode;a gradient linear model prediction mode; ora local illumination compensation prediction mode.A method of video encoding comprising:receiving video signals of video frames;performing prediction for a pixel in a video frame of the bitstream using a linear regression model, wherein the linear model comprises a slope and an offset, the slope comprises a numerator and a denominator;encoding the video frame to generate a coded video frame; andtransmitting a bitstream including the coded video frame;wherein for the linear model,a multiplication result is obtained by multiplying a first shifted value of the numerator and an inverse of a second shifted value of the denominator;an expected slope value is obtained based on prior knowledge of a prediction mode;an adaptive right shift value is calculated based on a difference between the multiplication result and the expected slope value, wherein the adaptive right shift value is determined based on a position of a most significant bit (MSB) of the difference, and the adaptive right shift value is used to right shift the difference to reverse an effect of a first right shift applied to the numerator and a second right shift applied to the denominator; anda final shift value is calculated for right shifting a temporary value obtained from the right shifted difference and an offset value of the linear model, wherein the final shift value is determined based on the adaptive right shift value and positions of unit place digits in the first shifted value and the second shifted value.The method of claim 41, wherein the final shift value is determined based on a precision of the linear model.The method of claim 41, wherein the adaptive right shift value is determined based on a number X, the X defines a number of significant bits of the slope.The method of claim 41, wherein the slope is used in at least one of:a cross-component linear model prediction mode;a gradient linear model prediction mode; ora local illumination compensation prediction mode.A method of video encoding comprising:receiving video signals of video frames;performing prediction for a pixel in a video frame of the bitstream using a linear model, wherein the linear model comprises a slope and an offset with fractional precision;encoding the video frame to generate a coded video frame; andtransmitting a bitstream including the coded video frame;wherein rounding an output of the linear model to integer precision is performed after calculating the linear model with the slope and offset; andwherein for the offset with fractional precisiona first term is obtained by left shifting a mean value of dependent variable samples by a first shift value;a second term is obtained by multiplying the slope with a mean value of independent variable samples; andthe offset value is a difference between the first term and the second term.The method of claim 45, wherein the first shift value is the same with a second shift value applied to the slope.The method of claim 45, wherein the first shift value is different from a second shift value applied to the slope.A method of video encoding comprising:receiving video signals of video frames;calculating a slope and an offset in a total least squares regression model of which both the independent variable and dependent variable contain errors;performing prediction for a pixel in a video frame of the bitstream using the total least squares regression model, wherein performing prediction using the total least squares regression model comprises integer arithmetic procedures for a numerator of the slope and a denominator of the slope;encoding the video frame to generate a coded video frame; andtransmitting a bitstream including the coded video frame.The method of claim 48, further comprising:determining whether to use the total least squares regression model or an ordinary least squares regression model based on at least one of:comparing a number of input samples to a first threshold;comparing an average value of independent variable samples to a second threshold; orcomparing a quantization parameter to a third threshold.An encoder comprising:a processor configured to call and run a computer program stored in a memory, to cause a device in which the processor is installed to execute the method of any of claims 28 to 49.A chip, comprising:a processor, configured to call and run a computer program stored in a memory, to cause a device in which the chip is installed to execute the method of any of claims 28 to 49.A computer-readable storage medium, in which a computer program is stored, wherein the computer program causes a computer to execute the method of any of claims 28 to 49.A computer program product, comprising a computer program, wherein the computer program causes a computer to execute the method of any of claims 28 to 49.A computer program, wherein the computer program causes a computer to execute the method of any of claims 28 to 49.