Method for determining probability estimate in cabac algorithm
By adapting α1 and α2 parameters in CABAC using optimization and refinement techniques, the method improves coding efficiency and reduces bitrates while managing computational complexity.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- SHENZHEN TCL NEW-TECH CO LTD
- Filing Date
- 2025-01-14
- Publication Date
- 2026-07-23
AI Technical Summary
Existing CABAC algorithms have limited adaptation to incoming data and increased computational complexity due to fixed or predetermined parameter values for α1 and α2, which hinders efficient probability estimation and coding efficiency.
Adapting α1 and α2 parameters based on recently encoded symbols using optimization algorithms like gradient descent, Cauchy, ADAM, RMSProp, and machine learning to optimize probability estimation, and refining these values with moving averages and quantization to reduce complexity.
Enhances coding efficiency by accurately tracking data statistics, reducing bitrates, and managing computational overhead through adaptive parameter updates.
Smart Images

Figure CN2025072372_23072026_PF_FP_ABST
Abstract
Description
METHOD FOR DETERMINING PROBABILITY ESTIMATE IN CABAC ALGORITHMTECHNICAL FIELD
[0001] The present disclosure generally relates to encoding and decoding technology, and in particular to a method for determining probability estimate in CABAC algorithm, a video coding apparatus, and a computer readable medium.BACKGROUND
[0002] Contemporary picture / video encoders represent picture / video content with the use of specifically designed syntax elements data that is produced by appropriate methods of data encoding. Nevertheless, data of syntax elements still exhibits some statistical redundancy. Thus, to reduce this redundancy, entropy coding is always used (for syntax elements of picture / video data) as the final stage of picture / video compression.
[0003] The latest generations of picture / video encoders use adaptive arithmetic encoding techniques as entropy coding methods. In the area of arithmetic encoding solutions, the most significant practical importance was gained by the Context-based Adaptive Binary Arithmetic Coding (CABAC) technique. This is due to the high coding efficiency of this technique, which has proven to be unrivaled in comparison to other known solutions.
[0004] CABAC technique exploits binary arithmetic encoding of data. The use of binary arithmetic encoding forces the necessity to binarize syntax elements data into the sequence of binary symbols (the so-called bins, with the value of 0 or 1) . For successive bins, the probability of a value of 0 and 1 is calculated when realizing the concept of context-based encoding. This concept involves encoding data that takes into account the values of selected data (the so-called context data) that have already been encoded before processing the current data symbol (s) . The process of selecting the context data is referred to as context modelling of data symbols. In CABAC, context modelling involves two mechanisms, which are extremely important from the point of view of CABAC encoding efficiency: 1) dividing the stream of bins into separate sub-streams of similar statistical properties; 2) the method of estimating the probabilities of incoming bins in individual sub-streams.
[0005] The data of syntax elements represents different types of video information (e.g., motion data, residual data of picture content prediction, control data) and, therefore, exhibits different statistical properties. Within the binarized word of the syntax element, the statistics of individual bins may also be different. Thus, an important step in CABAC encoding is to divide the stream of bins into a number of independent bins’ sub-streams (even hundreds of separate sub-streams) . The goal of this step is to group those bins that show similar statistical characteristics properly. Here, the CABAC algorithm uses very advanced solutions, which take into account factors like the type of the coded syntax element, the position of the bin in the binarized word, or values of the data that, within a (video) frame are neighbouring to the currently encoded data.
[0006] The efficiency of data encoding is influenced by the algorithm of bin probability estimation, which is realized independently within each of the previously prepared sub-streams of binary symbols.
[0007] The CABAC technique in ECM estimates the probabilities of binary symbols in sub-streams using a two-parameter estimation model (with the use of α1 and α2 parameters) . An additional element of the estimation mechanism used is an ongoing adaptation of the model parameter values based on the value of the last encoded binary symbol in the sub-stream. The way this adaptation is accomplished is largely predetermined, with limited ability to track the actual nature of the data being encoded.SUMMARY
[0008] Accordingly, the present disclosure aims to provide a method for determining probability estimate in CABAC algorithm, a video coding apparatus, and a computer readable medium.
[0009] A technical scheme adopted by the present disclosure is to provide a method for determining probability estimate of a current symbol in Context-Based Adaptive Binary Arithmetic Coding (CABAC) algorithm. The method includes: determining a first adaptation rate for a first context model and a second adaptation rate for a second context model based on historical probability information of a previously encoded symbol, wherein the historical probability information of the previously encoded symbol comprises a first historical probability information corresponding to the first context model and a second historical probability information corresponding to the second context model; generating a first probability estimate of the current symbol based on the first adaptation rate and the first historical probability information; generating a second probability estimate of the current symbol based on the second adaptation rate and the second historical probability information; and determining a probability estimate of current Least Probable Symbol (LPS) based on a weighted sum of the first probability estimate and the second probability estimate.
[0010] Another technical scheme adopted by the present disclosure is to provide a method for determining probability estimate in Context-Based Adaptive Binary Arithmetic Coding (CABAC) algorithm. The method includes: obtaining a stream to be coded; determining a plurality of candidate symbols from the stream; for each of the plurality of candidate symbols: determining a first adaptation rate for a first context model and a second adaptation rate for a second context model based on historical probability information of a previously encoded symbol; generating a first probability estimate and a second probability estimate of the current symbol based on the first adaptation rate and the second adaptation rate, respectively; and determining a probability estimate of current Least Probable symbol (LPS) based on a weighted sum of the first probability estimate and the second probability estimate.
[0011] Another technical scheme adopted by the present disclosure is to provide a video coding apparatus. The apparatus includes a processor and a memory. The memory is configured to store executable instructions that, when executed by the processor, cause the processor to perform any of the foregoing methods.
[0012] Another technical scheme adopted by the present disclosure is to provide a computer readable medium. The computer readable medium is configured to store executable instructions that, when executed by the processor, cause the processor to perform any of the foregoing methods.BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to clearly explain the technical solutions in the embodiments of the present disclosure, the drawings used in the description of the embodiments will be briefly described below. Obviously, the drawings in the following description are merely some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings may also be obtained based on these drawings without any creative work.
[0014] FIG. 1 is a flowchart of a method for determining probability estimate in CABAC algorithm according to an embodiment of the present disclosure.
[0015] FIG. 2 is a flowchart of a method for determining probability estimate in CABAC algorithm according to another embodiment of the present disclosure.
[0016] FIG. 3 shows a general process for applying the enhanced CABAC algorithm.
[0017] FIG. 4 shows an exemplary process for applying the enhanced CABAC algorithm in the RDO loop.
[0018] FIG. 5 shows an exemplary process for applying the enhanced CABAC algorithm after the RDO loop.
[0019] FIG. 6 shows an exemplary process for applying the enhanced CABAC algorithm for a limited number of bins.
[0020] FIG. 7 is a schematic diagram of an apparatus according to an embodiment of the present disclosure.DETAILED DESCRIPTION
[0021] The disclosure will now be described in detail with reference to the accompanying drawings and examples. Apparently, the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0022] The present disclosure refers to the field of picture / video coding and, specifically, to the improvements of entropy encoding, which performs an advanced compression of syntax elements data produced by a picture / video encoder. This disclosure presents a novel method for enhancing symbol probability estimation within adaptive arithmetic coding. To be more precise, the disclosure refers to the improvement of the Context-based Adaptive Binary Arithmetic Coding (CABAC) technique, a crucial entropy coding technique widely employed in video compression standards such as H. 264 AVC, H. 265 HEVCand H. 266 VVC. The proposed method addresses limitations in existing CABAC mechanisms by introducing different adaptation strategies for parameters of the model of data statistics, which influence the way probability calculations are done. By considering a history of recently encoded data symbols and employing a gradient-descent-based optimization algorithm, implementation of the present disclosure may enable more accurate tracking of data statistics, leading to improved coding efficiency and potential bitrate reduction.
[0023] To help understand the technical solutions proposed in the embodiments of this application, a brief introduction for the Context-Based Adaptive Binary Arithmetic Coding (CABAC) is given below.
[0024] In order to estimate statistics of data symbols (bins) , the “exponential aging” model of data statistics has been assumed. According to the concept of this model, the probability of the currently encoded bin depends on the values of some number of bins that directly precede the currently processed bin.
[0025] At this point, it is assumed that the impact (on the probability value of the current symbol) of each of the previously encoded bins is not the same. The influence of the bins that immediately precede the current symbol is bigger than the influence of those bins that had appeared much earlier. In line with this concept, the CABAC algorithm takes into account N “past” bins in the procedure of determining the statistics for the currently encoded bin. In the case of a bin referred to as LPS (least probable symbol) , the bin probability is expressed with the formula: pnew (LPS) =α·y (bin) + (1-α) ·pold (LPS) Eq. 1
[0026] In Eq. 1, y (bin) is equal to 0 if the current bin is an MPS symbol and equal to 1 otherwise; pold (LPS) is the probability of the LPS bin calculated earlier; α parameter directly depends on N and is equal to α = 1 / N.
[0027] As one can see, the procedure of probabilities estimation is controlled by the α parameter, the value of which depends directly on the number N of previously encoded bins. In the adopted mathematical formula, α determines the “strength” of the influence of successive previously encoded bins on the level of change of probability of the current bin. The first realizations of this idea (applied within H. 264 AVC and H. 265 HEVC standards) used one previously determined fixed value of α, equal to 1 / 19.69, which was the same for all bins’ sub-streams. Thus, more or less, fixed number N=19.69 of previously encoded bins were taken into account when estimating the probability for the new bin. The use of a fixed value of N limited the efficiency of the CABAC technique.
[0028] A natural extension of the original algorithm was to use simultaneously two different values of α: α1 and α2. Referring to Eq. 1, the extended CABAC calculates two different probability values when using two individual values of α. In the first studies, however, one pair of values α1 and α2 was used for all the sub-streams.
[0029] Later studies indicated the validity of using dedicated, experimentally determined pairs of values α1 and α2 for individual sub-streams. According to this idea, parameters α1 and α2 are selected in such a way to implement the two probability estimation scenarios simultaneously: scenario of quick adaptation of the probability values as a response to changing values of coded bins (parameter α1) , and scenario of slow adaptation (parameter α2) . As it is generally not known a priori which of these scenarios will turn out to be more advantageous (while encoding the current bin) , the method finally averages both obtained probabilities (see Eq. 2) , thus obtaining the final result of bin statistics estimation. In the process of this averaging, dedicated values of weights w1 and w2, determined experimentally for individual CABAC sub-streams, are used.
[0030] To further improve coding efficiency, a change in the values of α1 and α2 can be applied each time after encoding a binary data symbol. This is an adaptation of α1 and α2 values. The latter presented solutions, together with a simple mechanism for adapting the α1 and α2 parameters are currently being considered in works on the Enhanced Compression Model (ECM) . The fact of simplicity of the considered mechanism results from the application of two significant limitations:
[0031] 1. The change of parameter values of α1 and α2 is implemented based on the value of only the last encoded binary symbol (and not a larger number of past symbols) .
[0032] 2. The update of parameter values α1 and α2 is implemented based on previously prepared and stored in memory numbers defining the value of the correction for the parameters α1 and α2. In this way, the possibilities of real adaptation of the algorithm parameters to the current data statistics are very limited here.
[0033] So far, no studies have been presented in which the adaptation of parameters α1 and α2 would take into account a larger number of previously encoded symbols (bins) . In addition, no mechanism was considered to determine the optimal values of the α1 and α2 corrections by means of calculations performed on the fly and based on a set of previously encoded data. The latter solutions are the subject of the invention.
[0034] Furthermore, recent proposals have also appeared for improvements to CABAC that use artificial neural networks (machine learning) . However, such research should be considered as very preliminary. Although some of the results presented in the literature are very promising, the results refer to the coding of only selected, individual syntax elements of the video encoder. This is certainly due to the enormous computational complexity of the neural network training (machine learning) process. Therefore, in practice, it is extremely difficult to assess the real impact of the proposed solutions on the efficiency of entropy compression of all syntax elements that are present in the picture / video encoder. Furthermore, the mentioned application of machine learning does not address the idea of more efficient adaptation of parameters α1 and α2 considered in the invention.
[0035] The above-described existing CABAC algorithms have certain limitations.
[0036] One potential limitation is limited adaptation to incoming data. The CABAC technique in ECM estimates the probabilities of binary symbols in sub-streams using a two-parameter estimation model (with the use of α1 and α2 parameters –see the description of the CABAC presented earlier) . An additional element of the estimation mechanism used is an ongoing adaptation of the model parameter values based on the value of the last encoded binary symbol in the sub-stream. The way this adaptation is accomplished is largely predetermined, with limited ability to track the actual nature of the data being encoded. Therefore, the known solutions did not address the task of optimal selection and updating of α1 and α2 parameters in the probability estimation.
[0037] Another potential limitation is increased computational complexity. Using more advanced parameter value adaptation mechanisms to estimate symbol probabilities can noticeably increase the overall computational complexity of the arithmetic encoder. Calculation of probabilities is performed for each bin (even millions of bins per second) multiple times (almost 1,000 times) when the picture / video encoder uses the rate-distortion (RD) optimization. It must be emphasized that RD optimization is often used due to its high efficiency in controlling encoding mode selection in picture / video encoder.
[0038] Embodiments of the present disclosure aim to solve at least some of the above limitations. The possibility of using a more advanced method of adapting the CABAC model parameters values is proposed. In particular, the possibilities of using recently encoded symbols in the mechanism of adapting the model parameter values are exploited.
[0039] FIG. 1 is a flowchart of a method for determining probability estimate in CABAC algorithm according to an embodiment of the present disclosure. The method relates to the probability estimate optimization process for one symbol (the current symbol) . As shown in FIG. 1, the method includes operations described in blocks S101 to S104.
[0040] In S101, a first adaptation rate for a first context model and a second adaptation rate for a second context model are determined based on historical probability information of a previously encoded symbol.
[0041] The historical probability information of the previously encoded symbol includes a first historical probability information corresponding to the first context model and a second historical probability information corresponding to the second context model.
[0042] As introduced in foregoing sections (see Eq. 2) , the determination of the probability estimate of a current symbol (bin) may depend on two probability estimate components and which correspond to two context models respectively. The first adaptation rate is the parameter α1 for the first probability estimate while the second adaptation rate is the parameter α2 for the second probability estimate Each probability estimate component can be derived using the following equation: pα(LPS) =α·y (bin) + (1-α) ·pold (LPS) Eq. 3
[0043] In this equation, y (bin) is equal to 0 if the current bin is a Most Probable Symbol (MPS) and equal to 1 if the current bin is Least Probable Symbol (LPS) ; pold (LPS) is the probability of the LPS bin calculated for the previous symbol, i.e., the historical probability information.
[0044] In conventional CABAC design, values of the first adaptation rate α1 and the second adaptation rate α2 are predefined and fixed. In contrast, the proposed method adapts α1 and α2 by considering recently encoded symbols. Detailed explanation is give below.
[0045] The operation of determining the first adaptation rate and the second adaptation rate may include: when the current symbol is an LPS, determining the first adaptation rate and the second adaptation rate with an optimization function to maximize the weighted sum of the first probability estimate and the second probability estimate of the current LPS. Alternatively, the operation of determining the first adaptation rate and the second adaptation rate may include: when the current symbol is a Most Probable Symbol (MPS) , determining the first adaptation rate and the second adaptation rate with an optimization function to minimize the weighted sum of the first probability estimate and the second probability estimate of the current LPS. By maximizing the probability estimate of the current block, the number of bits that are produced by arithmetic encoder of the CABAC may be reduced.
[0046] In one embodiment, the optimization function may be a logarithm base 2 function.
[0047] Specifically, when the current symbol is the LPS (if bin=MPS) , the optimization function is:
[0048] In the formula, α1 is the first adaptation rate; α2 is the second adaptation rate; p (α1, α2) is the weighted sum of the first probability estimate and the second probability estimate of LPS symbol.
[0049] When the current symbol is the MPS (if bin=MPS) , the optimization function is:
[0050] In the formula, α1 is the first adaptation rate; α2 is the second adaptation rate; p (α1, α2) is the weighted sum of the first probability estimate and the second probability estimate of LPS symbol.
[0051] Using the equations Eq. 2 and Eq. 3, and assuming y (1) (bin) is equal to 0 when the current symbol is MPS in the first probability estimate model and y (1) (bin) is equal to 1 when the current symbol is LPS in the first probability estimate model, and assuming y (2) (bin) is equal to 0 when the current symbol is MPS in the second probability estimate model and y (2) (bin) is equal to 1 when the current symbol is LPS in the second probability estimate model, we can obtain:
[0052] In the above formulas, is the probability of LPS for the current symbol calculated using α1; is the probability of LPS for the previous symbol; is the probability of LPS for the current symbol calculated using α2; is the probability of LPS for the previous symbol; w1 and w2 are values used for weighing probabilities.
[0053] The number of bits that are produced by arithmetic encoder of the CABAC is calculated as -log2 (p_symbol) , where p_symbol is the probability of the symbol. The use of the log2 function helps to quantify the information content of the symbol, or in other words, it provides a measure of the "surprise" or "uncertainty" associated with the symbol's occurrence. This is particularly useful in the context of information theory and data compression, as it allows for the efficient encoding of symbols based on their probabilities.
[0054] The function utilized in the optimization process may be directly signaled to decoder by dedicated syntax elements in e.g. SPS, PPS, picture header or slice header.
[0055] An initial first adaptation rate corresponding to the first context model and an initial first adaptation rate corresponding to the second context model may be determined based on one selected based on: statistics obtained from a set of selected previous sequences; an sub-stream index, a type of stream, or a slice type to which the current symbol belongs; a decoder profile; or an indication received from an encoder. The initial values of the first and second adaptation rates may be utilized for determining the probability estimate of a first symbol involved in this CABAC algorithm.
[0056] Specifically, the initial values of α1 and α2 parameters (e.g. used as starting values at the beginning of each slice) can be set based on statistics obtained from a set of selected sequences and stored in decoder as default values. These values may be common or distinct for each of the sub-streams and, similarly, common or distinct for each slice type.
[0057] The initial values can be further adapted or selected by sub-stream index (sub-stream identifier) or type (e.g. all sub-streams related to transform coefficients or motion vectors) , slice type (I / P / B-slice) , decoder profile (e.g. main profile) or by a dedicated syntax element signaled in e.g. SPS, PPS, picture header or slice header which selects a set of values among predefined values stored in decoder (e.g. in form of look-up table) . Alternatively, initial values for alpha can be directly signaled to decoder by dedicated syntax elements in e.g. SPS, PPS, picture header or slice header.
[0058] The optimization algorithm that performs the optimization of objective function may include at least one selected from: direct search optimization algorithms, gradient-based optimization, quasi-Newton optimization, and machine-learning-based optimization. Explanation of different optimization methods are given below.
[0059] Option 1: Generalized optimization
[0060] The method of generalized optimization for a function with two variables, f (α1, α2) , encompasses the following steps:
[0061] 1) Calculate the partial derivatives of f (α1, α2) with respect to both α1 and α2 variables.
[0062] 2) Locate points (α1, α2) where both first-order partial derivatives are simultaneously zero. These are potential locations of maxima, minima, or saddle points.
[0063] 3) Optional: Compute the second-order partial derivatives and construct the Hessian matrix to classify each critical point.
[0064] Option 2: Cauchy-based optimization
[0065] The method of Cauchy-based optimization encompasses the following steps:
[0066] 1) Calculate the partial derivatives of f (α1, α2) with respect to both α1 and α2 variables.
[0067] 2) Apply the Cauchy optimization algorithm, using the calculated derivatives, to iteratively adjust α1 and α2. The Cauchy method determines the search direction based on the gradient (vector of first-order partial derivatives) and performs a line search to find the optimal direction of transition to new values of α1 and α2.
[0068] Simple options of the optimization algorithm may assume no additional scaling or cropping of gradient vector elements.
[0069] Gradient vector elements can be either scaled to change the speed of optimization (e.g., slowing down of the optimization by multiplying gradient by 10-3) , or cropped to a predefined range (e.g., from -10-6 to 10-6. In one example, the scale can be adapted based on the iteration number for the current slice or picture, e.g., using a smaller scale value for the first or last predefined number of iterations, which implements warm-up or saturation behavior. The value of scale may also be changed based on a predefined scheduling scheme, e.g., linearly or exponentially decreased in each optimization step with a set step size of exponent.
[0070] 3) Update the values of α1 and α2 based on the result of step 2 of the Cauchy optimization.
[0071] Option 3: ADAM optimization
[0072] ADAM (Adaptive Moment Estimation) is another optimization algorithm that can be used to adapt the α1 and α2 parameters. It is an extension of the stochastic gradient descent method (e.g., the extension of the Cauchy method) and is particularly well-suited for problems with large datasets and high-dimensional parameter spaces. In contrast to a simple variant of the Cauchy algorithm (see description of Variant #1) , ADAM introduces appropriate scaling of gradient vector elements based on the ‘learning_rate’ parameters (one parameter for α1 and second for α2 ) first-order moment and second-order moment. In this way, ADAM incorporates momentum to accelerate the optimization process and, at the same time, adjusts the effective value of ‘learning_rate, ’ which makes the whole optimization process more robust against the initial value of the ‘learning_rate’ itself. The amount of smoothing applied by first and second-order moments is controlled by β1 and β2 parameters, respectively.
[0073] 1) Calculate the partial derivatives of f (α1, α2) with respect to both α1 and α2 variables.
[0074] 2) Update the moment estimates, mt+1 and vt+1, using the calculated gradient elements and the previous moment estimates, mt and vt.
[0075] 3) Calculate the bias-corrected moment estimates, and to correct for the initialization bias in the moment estimates.
[0076] 4) Update the values of α1 and α2 using the bias-corrected moment estimates and the learning rate. The learning rate determines the step size in the direction of the minimum and its value should be tuned to achieve the best performance.
[0077] In order to reduce the computational complexity, the square root can be approximated using, e.g., the Newton-Raphson method which is an iterative algorithm for finding successively better approximations to the roots (or zeros) of a real-valued function. To find the square root of a number S, we can frame it as finding the root of the function: f (x) = x2 -S
[0078] The derivative of this function is: f′ (x) = 2x
[0079] The general Newton-Raphson iterative formula is: xn+1 = xn -f (xn) / f′ (xn)
[0080] Applying this to the square root function, we get:
[0081] Simplifying this, we arrive at the iterative formula specifically for square root approximation:
[0082] Option 4: RMSProp optimization
[0083] Besides the ADAM algorithm, presented in previous section, one can use RMSProp. Adam can be seen as a combination of RMSProp and momentum. Like RMSProp, Adam adapts the learning rate for each parameter, but it also incorporates momentum to accelerate the optimization process. In RMSProp:
[0084] 1) Calculate the partial derivatives of f (α1, α2) with respect to both α1 and α2 variables.
[0085] 2) Update Et = βE {t-1} + (1 -β) derivative2 , where Et is the moving average of squared gradients, and β is a decay rate (hyperparameter) typically set around 0.9 or 0.999.
[0086] 3) Update
[0087] Option 5: Machine-learning-based optimization
[0088] Machine learning techniques can also be employed to optimize the α1 and α2 parameters. This approach involves training a machine-learning model on a large dataset of encoded video sequences. The model learns the relationship between the input bins and the optimal values of α1 and α2 that minimize the bitrate. Once trained, the model can be used to predict the parameter values for new video sequences. Therefore, here update the values of α1 and α2 is based on the result of the used machine learning algorithm. These algorithms can be, but are not limited to, ones based on supervised learning algorithms (e.g., Support Vector Machines (SVMs) or Support Vector Regression (SVR) ) or reinforcement learning methods. In general, classification methods can be applied to select values of α1 and α2 parameters from a predefined set of values and regression methods may predict these values directly (e.g., as continuous variables) .
[0089] The simple application of the above-mentioned solutions (but also the application of any optimization algorithm) may be problematic in the case of data sub-streams that contain a relatively small number of binary symbols. In such cases, the key element will be the applied starting settings for the method (e.g., the starting point for the optimization algorithm) . This comes down to the need for prior tuning of the method using a suitably large set of training data.
[0090] Values of the first adaptation rate and the second adaptation rate derived from the above optimization process may be further refined. Several possible refinement methods are provided below.
[0091] In one embodiment, the operation of determining the first adaptation rate and the second adaptation rate may further include: acquiring a first limitation for the first adaptation rate and a second limitation for the second adaptation rate; when a value of the first adaptation rate determined based on the optimization function exceeds the first limitation, adjusting the value of the first adaptation rate based on the first limitation; and / or when a value of the second adaptation rate determined based on the optimization function exceeds the second limitation, adjusting the value of the second adaptation rate based on the second limitation.
[0092] In this method, limitation of the range of possible values is applied. To ensure stability and prevent extreme values that could negatively impact coding performance, the optimized values of α1 and α2 can be limited to a predefined range. Even if the optimization algorithm suggests values outside this range, they are clipped to the nearest boundary value. The example of predefined range for α1 is from to 1 / 4, while for α1 from to
[0093] In one embodiment, the operation of determining the first adaptation rate and the second adaptation rate may further include: calculating a moving average value for the first adaptation rate based on values of one or more previous adaptation rates of the first context model; and calculating a moving average value for the second adaptation rate based on values of one or more previous adaptation rates of the second context model.
[0094] In this method, moving average is applied. A moving average can be applied to further smooth out the changes in the optimized values of α1 and α2. This technique involves weighting the current optimized values with the previous values, creating a weighted average that reflects the recent history of the parameters. By incorporating past values, the moving average reduces the impact of sudden or transient changes in the optimized values, leading to more stable and gradual adjustments in the probability estimation model. Specifically, the process may include the following steps:
[0095] 1) Define a window size for the moving average. This window size determines the number of previous values of α1 and α2 to consider in the average. For example, a window size of 5 would include the current optimized values of α1 and α2 and the 4 most recent previous values (from recently encoded symbols) .
[0096] 2) After each optimization step, calculate the moving average for α1 and α2 using the current optimized values and the previous values within the window. The moving average can be a simple average or a weighted average, where more recent values are given higher weights.
[0097] If a simple moving average is applied, the equation is: Moving Average = (Sum of values in the window) / (Window size)
[0098] If a weighted moving average is applied, the equation is: Moving Average = (Sum of (value * weight) ) / (Sum of weights)
[0099] 3) Use the moving average values for α1 and α2 in the probability estimation model.
[0100] It should be noticed, two possible methods may be utilized for computing this moving average.
[0101] The first method can be denoted as a direct method. This approach involves storing a predefined number of previous adaptation rate values, which are calculated based on the optimization function. Each of these values is then assigned a decaying weight, and these weighted values are averaged to compute the moving average.
[0102] The second method can be denoted as an iterative method. This more practical and generally preferred approach requires storing only the previous value of the moving average, which is the adaptation rate used by the context model in the previous step. This stored value is then weighted together with the new adaptation rate value (calculated based on the optimization function) to compute the updated moving average. This method is particularly advantageous due to its efficiency and reduced storage requirements.
[0103] In one embodiment, the operation of determining the first adaptation rate and the second adaptation rate may further include: quantizing values for the first adaptation rate and the second adaptation rate determined based on the optimization function with a pre-defined precision or a set of predefined candidate values for adaptation rates.
[0104] In this method, quantization operation is applied. A quantization operation can be applied to optimized values of α1 and α2 to further reduce complexity and allow more efficient hardware implementation. This technique consists of approximating the exact values of α1 and α2 by values with predefined precision or selecting the closest value from a predefined subset of values to represent the original, non-quantized value. The exact implementation of such functionality may include the quantization of the new value of α1 and α2, quantization of only the update value to be added to the previous value of α1 and α2, or quantifying the sign and module of the update value to decide about the transition from the previous value of α1 and α2 to the new value (selected from a predefined set of values) if the module is large enough (which resembles transitions in a state machine) .
[0105] In addition, the quantized values of α1 and α2 , besides being used to calculate the LPS / MPS probabilities, may also be stored instead of original, non-quantized values of α1 and α2 and used in computations during the next optimization step. This way, internal representation for storing the current values of α1 and α2 can be also simplified and require less memory.
[0106] Refinement may be performed always (unconditionally) , only for selected sub-streams, for all streams if the change of alpha value in several last optimization steps is significant based on predefined / signaled / adaptive threshold (e.g., change >10%after 5 optimization steps) , if refinement is enabled by a dedicated syntax element signaled in a bitstream (e.g., in SPS, PPS, slice header, picture header) .
[0107] In S102, a first probability estimate of the current symbol is generated based on the first adaptation rate and the first historical probability information.
[0108] In S103, a second probability estimate of the current symbol is generated based on the second adaptation rate and the second historical probability information.
[0109] In S104, a probability estimate of current LPS is determined based on a weighted sum of the first probability estimate and the second probability estimate.
[0110] Once the first adaptation rate and the second adaptation rate are determined based on the optimization algorithm, the probability estimate of current LPS may be determined. This operation may be similar to conventional CABAC, using the method described with reference to Eq. 4.
[0111] As described above, the present embodiment involves adapting the first adaptation rate α1 and the second adaptation rate α2 by considering recently encoded symbols. The optimization algorithm is employed to iteratively determine the optimal values of α1 and α2 that minimize the bitstream size. This approach allows the estimation to capture more complex patterns and dependencies within the data stream, providing a more comprehensive view of the data’s local statistical behavior.
[0112] In one embodiment, the CABAC algorithm as described above may be applied within a Rate-Distortion Optimization (RDO) loop. Specifically, the method may be applied both within and after the RDO loop. Alternatively, the CABAC algorithm as described above may be applied only after the RDO loop.
[0113] FIG. 2 is a flowchart of a method for determining probability estimate in CABAC algorithm according to another embodiment of the present disclosure. As shown in FIG. 2, the method includes operations described in blocks S201 to S205.
[0114] In S201, a stream to be coded is obtained.
[0115] In S202, candidate symbols are determined from the stream.
[0116] This operation serves to manage computational complexity.
[0117] In one embodiment, the operation of determining the plurality of candidate symbols from the stream may include: responsive to a number of encoded symbols in the stream exceeding a predefined amount threshold or a predefined ratio threshold, selecting remaining symbols in the stream as the plurality of candidate symbols.
[0118] In one embodiment, the operation of determining the plurality of candidate symbols from the stream may include: selecting a pre-defined number of symbols or a pre-defined ratio of symbols located at beginning of the stream as the plurality of candidate symbols.
[0119] Specifically, the candidate symbols may be limited by number. The modified probability estimation based on the optimized α1 and α2 values can be limited to a specific number of symbols in each sub-stream. Therefore, only if the number of the incoming symbol is larger than set threshold (e.g., 50,000) , then the optimization of α1 and α2 values should be performed. This limitation is particularly beneficial for sub-streams with a small number of symbols, where the computational overhead of the optimization process might outweigh the potential gains in coding efficiency.
[0120] As a variant, the optimization of α1 and α2 values can be limited to be performed only after a specified number of the incoming symbols were processed (e.g. 1000) . Alternatively, the optimization may be performed for a specified number of incoming symbols, while the remaining symbols use the last values of α1 and α2. The specified number can be predefined or signaled by a dedicated syntax element (e.g. in SPS, PPS, slice header, picture header) . The adaptation of the specified number can be common for all sub-streams or set individually for each sub-stream. Additionally, the specified number can be set for whole sequence, group of pictures (GOP) , picture or slice.
[0121] Moreover, instead of limiting the modified probability estimation to a fixed number of symbols, it can also be limited to a certain percentage of the total number of symbols in each sub-stream. Therefore, only if the number of the incoming symbols is larger than a set threshold (e.g., 50%percent of all symbols in the current sub-stream) , then the optimization of α1 and α2 values should be performed. This approach allows for more flexibility in adjusting the computational complexity based on the length and characteristics of the sub-stream.
[0122] As a variant, the optimization of α1 and α2 values can be limited to be performed only after a specified number of the incoming symbols were processed (e.g. 10%) . Alternatively, the optimization may be performed for a specified number of incoming symbols, while the remaining symbols use the last values of α1 and α2. The specified number can be predefined or signaled by a dedicated syntax element (e.g. in SPS, PPS, slice header, picture header) . The adaptation of the specified number can be common for all sub-streams or set individually for each sub-stream. Additionally, the specified number can be set for whole sequence, group of pictures (GOP) , picture or slice.
[0123] In one embodiment, an amount of symbols contained in the stream is larger than a predefined amount threshold. Alternatively, an amount ratio of symbols contained in the stream is larger than a predefined ratio threshold.
[0124] Specifically, a condition may be set to trigger the optimization algorithm only when the number of symbols encoded in a sub-stream exceeds a certain threshold, for example, after 50,000 symbols have been processed. This approach is particularly beneficial for sub-streams with a small number of symbols, where the computational overhead of the optimization process might outweigh the potential gains in coding efficiency.
[0125] For each candidate symbol, the following operations S203 to S205 are performed.
[0126] In S203, a first adaptation rate for a first context model and a second adaptation rate for a second context model are determined based on historical probability information of a previously encoded symbol.
[0127] In S204, a first probability estimate and a second probability estimate of the current symbol are generated based on the first adaptation rate and the second adaptation rate, respectively.
[0128] In S205, a probability estimate of current LPS is determined based on a weighted sum of the first probability estimate and the second probability estimate.
[0129] In one embodiment, the CABAC algorithm as described above may be applied within a Rate-Distortion Optimization (RDO) loop. Specifically, the method may be applied both within and after the RDO loop. Alternatively, the CABAC algorithm as described above may be applied only after the RDO loop.
[0130] FIG. 3 shows a general process for applying the enhanced CABAC algorithm according to another embodiment of the present disclosure. The process shown in FIG. 3 may include the following steps:
[0131] 1) Compute two initial probability estimates and using the following equation and individual starting values of α (α1 and α2) in each of the CABAC context model. pα (LPS) =α·y (bin) + (1-α) ·pold (LPS)
[0132] In the formula, y (bin) is equal to 0 if the current bin is an MPS symbol and equal to 1 otherwise; pold (LPS) is the probability of the LPS bin calculated for the previous symbol.
[0133] 2) Combine the two probability estimates and using equation (2) to generate a probability for the Least Probable Symbol (LPS) .
[0134] 3) Calculate the probability of the Most Probable Symbol (MPS) as 1 minus the LPS probability.
[0135] 4) If the condition for performing the optimization is met, proceed to the next step; if not, proceed to step 9.
[0136] 5) Define a cost function, f (α1, α2) , which determines the number of bits that would be generated by the arithmetic encoding process when encoding a given symbol (either LPS or MPS) . This function serves objective function of optimization. The goal of optimization is to minimize function f (α1, α2) .
[0137] 6) Update the values of α1 and α2 using the result of the used optimization method.
[0138] 7) Refine the values of α1 and α2 (optional) .
[0139] 8) Update the probabilities of the LPS and MPS using the refined values of α1 and α2.
[0140] 9) Use the probabilities of the LPS and MPS for encoding the next symbol.
[0141] As in a standard image / video codecs, the process of calculating the probabilities that the next symbol is LPS or MPS is the same in an encoder and in a decoder. The only change in the decoder is that in step 9 the calculated probabilities are used for decoding the next symbol.
[0142] The enhanced CABAC algorithm may be applied in the rate-distortion optimization loop. FIG. 4 shows an exemplary process for applying the enhanced CABAC algorithm in the RDO loop.
[0143] This solution involves updating the probability estimation model every time CABAC is used in coding, also during the rate-distortion optimization (RDO) process.
[0144] In video encoding, Rate-Distortion Optimization (RDO) is a key process used to find the best encoding parameters for a block of video data. The encoder tests different ways to encode the block, such as different prediction modes or quantization parameters, and calculates the rate (number of bits) and distortion (quality loss) for each method . To estimate the rate accurately, Context-Adaptive Binary Arithmetic Coding (CABAC) is employed within the RDO loop.
[0145] Unlike prior art that uses pre-determined values of α1 and α2 , in this solution, these CABAC model parameters are adjusted (optimized) for each encoded symbol, allowing it to adapt to the changing statistics of the data. This can improve coding efficiency due to more accurate probability estimation. This enhanced adaptability comes at the cost of increased computational complexity. The optimization algorithm, which could be a gradient-descent-based method like Cauchy optimization or ADAM optimization, needs to be executed frequently, potentially impacting the overall encoding speed.
[0146] The enhanced CABAC algorithm may be applied after the rate-distortion optimization loop. FIG. 5 shows an exemplary process for applying the enhanced CABAC algorithm after the RDO loop.
[0147] To address the computational overhead of the previous solution, this solution suggests updating the probability model only when CABAC is used outside the RDO loop. Therefore, the proposed optimization of the CABAC model parameters (α1 and α2) is applied after the encoder has selected the best encoding method for the block.
[0148] This approach achieves smaller coding efficiency compared to the previous solution. However, even after the RDO process has converged on the optimal encoding parameters using the non-optimized CABAC model parameters, their optimization done outside RDO loop still can improve the overall efficiency of encoding.
[0149] FIG. 6 shows an exemplary process for applying the enhanced CABAC algorithm for a limited number of bins.
[0150] This solution proposes applying the enhanced probability estimation only to a limited number of symbols at the end of a data stream. A condition is set to trigger the optimization algorithm only when the number of symbols encoded in a sub-stream exceeds a certain threshold, for example, after 50,000 symbols have been processed.
[0151] This approach is particularly beneficial for sub-streams with a small number of symbols, where the computational overhead of the optimization process might outweigh the potential gains in coding efficiency. The implementation of this approach may limit computational complexity increase, and therefore ensuring that the proposed method does not significantly impact the overall encoding and decoding complexity.
[0152] As introduced in foregoing sections, embodiments of the present disclosure apply adaptation of α1 and α2 by considering recently encoded symbols. The optimization algorithm is employed to iteratively determine the optimal values of α1 and α2 that minimize the bitstream size. After the optimization step, the values of α1 and α2 can be further refined to control the speed of the changing their values. After this, they are used to estimate probability of the incoming symbol being LPS or MPS. This approach allows the estimation to capture more complex patterns and dependencies within the data stream, providing a more comprehensive view of the data’s local statistical behavior. As initial experiments have shown, the optimization could be done in the final CABAC pass, i.e., outside the RD optimization loop, when still increasing the coding efficiency of data (up to -0.03%of bitrate decrease in comparison with ECM-based CABAC) .
[0153] Benefits of implementation of the present disclosure may include at least one of the followings:
[0154] 1) enhanced coding efficiency: more accurate probability estimation leads to improved compression ratios and reduced bitrates of data that represents picture / video;
[0155] 2) improved adaptability of encoding parameters: the method can adapt more effectively to rapid changes in the statistical properties of the picture / video data;
[0156] 3) significant compatibility: can be integrated into existing CABAC implementations with minimal modifications;
[0157] 4) limited computational complexity increase (in practice, no effect on the change in picture / video encoder complexity and a relatively small increase in picture / video decoder complexity) .
[0158] FIG. 7 conceptually illustrates an apparatus 300 with which some embodiments of the invention are implemented. The apparatus 300 may be an encoding device or a decoding device. The apparatus 300 may be a computer (e.g., a desktop computer, personal computer, tablet computer, etc. ) , phone, PDA, or any other sort of electronic device. Such an apparatus includes various types of computer readable media and interfaces for various other types of computer readable media. The apparatus 300 includes a processor 302 and a memory 304. The memory 304 is configured to store executable instructions that, when executed by the processor, cause the processor to perform any one of the foregoing decoding or encoding methods.
[0159] The processor 302 may be a single processor or a multi-core processor in different embodiments. In some embodiments, the processor may include a GPU, NPU or DSP which may offload various computations or complement the image processing provided by the processor 302.
[0160] Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media) . Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM) , recordable compact discs (CD-R) , rewritable compact discs (CD-RW) , read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM) , a variety of recordable / rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc. ) , flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc. ) , magnetic and / or solid state hard drives, read-only and recordable discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.
[0161] While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs) . In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself. In addition, some embodiments execute software stored in programmable logic devices (PLDs) , ROM, or RAM devices.
[0162] As used in this specification and any claims of this application, the terms “computer” , “server” , “processor” , and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. As used in this specification and any claims of this application, the terms “computer readable medium, ” “computer readable media, ” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.
[0163] The present disclosure further provides a computer readable media which is configured to store executable instructions. When the instructions are executed by a processor, the processor may perform any one of the foregoing methods and processes. Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium) . When these instructions are executed by one or more computational or processing unit (s) (e.g., one or more processors, cores of processors, or other processing units) , they cause the processing unit (s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, random access memory (RAM) chips, hard drives, erasable programmable read only memories (EPROMs) , electrically erasable programmable read-only memories (EEPROMs) , etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections.
[0164] In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs.
[0165] While the disclosure has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. In addition, a number of the figures conceptually illustrate processes and methods. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process.
[0166] The foregoing is merely embodiments of the present disclosure, and is not intended to limit the scope of the disclosure. Any transformation of equivalent structure or equivalent process which uses the specification and the accompanying drawings of the present disclosure, or directly or indirectly application in other related technical fields, are likewise included within the scope of the protection of the present disclosure.
Claims
1.A method for determining probability estimate of a current symbol in Context-Based Adaptive Binary Arithmetic Coding (CABAC) algorithm, comprising:determining a first adaptation rate for a first context model and a second adaptation rate for a second context model based on historical probability information of a previously encoded symbol, wherein the historical probability information of the previously encoded symbol comprises a first historical probability information corresponding to the first context model and a second historical probability information corresponding to the second context model;generating a first probability estimate of the current symbol based on the first adaptation rate and the first historical probability information;generating a second probability estimate of the current symbol based on the second adaptation rate and the second historical probability information; anddetermining a probability estimate of current Least Probable Symbol (LPS) based on a weighted sum of the first probability estimate and the second probability estimate.2.The method of claim 1, wherein the determining the first adaptation rate and the second adaptation rate comprises:when the current symbol is an LPS, determining the first adaptation rate and the second adaptation rate with an optimization function to maximize the weighted sum of the first probability estimate and the second probability estimate of the current LPS; orwhen the current symbol is a Most Probable Symbol (MPS) , determining the first adaptation rate and the second adaptation rate with an optimization function to minimize the weighted sum of the first probability estimate and the second probability estimate of the current LPS.3.The method of claim 2,wherein when the current symbol is the LPS, the optimization function is:wherein when the current symbol is the MPS, the optimization function is:wherein:α1 is the first adaptation rate;α2 is the second adaptation rate;p (α1, α2) is the weighted sum of the first probability estimate and the second probability estimate of LPS symbol.4.The method of claim 2, wherein the optimization algorithm that performs the optimization of objective function is at least one selected from:direct search optimization algorithms, gradient-based optimization, quasi-Newton optimization, and machine-learning-based optimization.5.The method of claim 2, wherein the determining the first adaptation rate and the second adaptation rate further comprises:acquiring a first limitation for the first adaptation rate and a second limitation for the second adaptation rate;when a value of the first adaptation rate determined based on the optimization function exceeds the first limitation, adjusting the value of the first adaptation rate based on the first limitation; and / orwhen a value of the second adaptation rate determined based on the optimization function exceeds the second limitation, adjusting the value of the second adaptation rate based on the second limitation.6.The method of claim 2, wherein the determining the first adaptation rate and the second adaptation rate further comprises:calculating a moving average value for the first adaptation rate based on values of one or more previous adaptation rates of the first context model; andcalculating a moving average value for the second adaptation rate based on values of one or more previous adaptation rates of the second context model.7.The method of claim 2, wherein the determining the first adaptation rate and the second adaptation rate further comprises:quantizing values for the first adaptation rate and the second adaptation rate determined based on the optimization function with a pre-defined precision or a set of predefined candidate values for adaptation rates.8.The method of claim 1, wherein an initial first adaptation rate corresponding to the first context model and an initial first adaptation rate corresponding to the second context model are determined based on one selected based on:statistics obtained from a set of selected previous sequences;an sub-stream index, a type of stream, or a slice type to which the current symbol belongs;a decoder profile; oran indication received from an encoder.9.The method of claim 1,wherein the CABAC algorithm is applied within a Rate-Distortion Optimization (RDO) loop.10.The method of claim 1,wherein the CABAC algorithm is applied after a Rate-Distortion Optimization (RDO) loop.11.A method for determining probability estimate in Context-Based Adaptive Binary Arithmetic Coding (CABAC) algorithm, comprising:obtaining a stream to be coded;determining a plurality of candidate symbols from the stream;for each of the plurality of candidate symbols:determining a first adaptation rate for a first context model and a second adaptation rate for a second context model based on historical probability information of a previously encoded symbol;generating a first probability estimate and a second probability estimate of the current symbol based on the first adaptation rate and the second adaptation rate, respectively; anddetermining a probability estimate of current Least Probable symbol (LPS) based on a weighted sum of the first probability estimate and the second probability estimate.12.The method of claim 11,wherein the CABAC algorithm is applied within a Rate-Distortion Optimization (RDO) loop.13.The method of claim 11,wherein the CABAC algorithm is applied after a Rate-Distortion Optimization (RDO) loop.14.The method of claim 11, wherein the determining the plurality of candidate symbols from the stream comprises:responsive to a number of encoded symbols in the stream exceeding a predefined amount threshold or a predefined ratio threshold, selecting remaining symbols in the stream as the plurality of candidate symbols.15.The method of claim 11, wherein the determining the plurality of candidate symbols from the stream comprises:selecting a pre-defined number of symbols or a pre-defined ratio of symbols located at beginning of the stream as the plurality of candidate symbols.16.The method of claim 11,wherein an amount of symbols contained in the stream is larger than a predefined amount threshold; orwherein an amount ratio of symbols contained in the stream is larger than a predefined ratio threshold.17.A video coding apparatus, comprising a processor and a memory, wherein the memory is configured to store executable instructions that, when executed by the processor, cause the processor to perform the method of any of claims 1 to 16.18.A computer readable medium storing executable instructions that, when executed by a processor, cause the processor to perform the method of any of claims 1 to 16.