# A High Efficiency Multistage Coder for Lossless Audio Compression using OLS+ and CDCCR Method
## 4 Complex Prediction Method with Backward Adaptation
### Ols+  
Extended version of Ordinary Least Square (OLS+) is characterised by a slightly more computational complexity than RLS. In addition to the update (\(O(r^{2})\) complexity, as in RLS) of the square matrix \(\mathbf{R}(n)\) autocovariance (\(r\times r\) dimensions), an additional procedure for determining the inverse matrix with the \(O(r^{3})\) complexity is required.  
In the OLS+ method, prediction coefficients are calculated adaptively, individually for each coded sample, minimising the mean square error in a certain limited backward area. The influence of older samples is limited by the use of the forgetting effect determined by the factor \(f_{\!f}\).  
In OLS+, the basic matrix equation used to calculate the vector \(\mathbf{w}(n)\) has been extended by the element \(u_{\mathrm{bias}}\), which comes from the principles of ridge regression [28]. The \(u_{\mathrm{bias}}\) element modifies the main diagonal values in autocovariance matrix \(\mathbf{R}(n)\). This prevents the occurrence of a singular matrix and also improves the overall efficiency of modelling. The vector of prediction coefficients is obtained by solving the matrix equation (for simplification the designations of \(L\) and \(R\) channels have been removed at this point, remembering that for each channel, there are separate \(\mathbf{R}_{Ch}(n)\) matrix's and vectors \(\mathbf{w}_{L}(n)\) and \(\mathbf{w}_{R}(n)\), as described in Section 2, Formula (2)):  
\[\mathbf{w}(n+1)=\mathbf{R}_{\mathrm{bias}}^{-1}(n+1)\cdot\mathbf{q}(n+1), \tag{12}\]  
where the matrix \(\mathbf{R}_{\mathrm{bias}}(n+1)\) is complemented by a value \(u_{\mathrm{bias}}(n+1)\):  
\[\mathbf{R}_{\mathrm{bias}}(n+1)=\mathbf{R}(n+1)+u_{\mathrm{bias}}(n+1)\cdot \mathbf{I}, \tag{13}\]  
where \(\mathbf{I}\) is a identity matrix. In [16], \(u_{\mathrm{bias}}\) was a fixed value. Based on the work in [28], it was proposed to determine the \(u_{\mathrm{bias}}\) in the following way,  
\[u_{\mathrm{bias}}(n+1)=\frac{r\cdot(1-f_{\!f})\cdot c_{\mathrm{OLS}}\cdot e^{2 }(n)}{\max\biggl{\{}1,w_{j}^{2}(n)\biggr{\}}},\;\mathrm{for}j\in\overline{1; r}. \tag{14}\]Elements \(R_{j,i}(n+1)\) of the matrix \(\mathbf{R}(n+1)\) with dimensions \(r\times r\) are updated after encoding each subsequent sample as follows.  
\[R_{j,i}(n+1)=c_{\text{OLS}}\cdot x(n-i)\cdot x(n-j)+f_{r}R_{j,i}(n). \tag{15}\]  
Therefore, the elements \(q_{j}(n+1)\) of the vector \(\mathbf{q}(n+1)\) with dimensions \(r\times 1\) are updated as follows.  
\[q_{j}(n+1)=c_{\text{OLS}}\cdot x(n)\cdot x(n-j)+f_{r}q_{j}(n). \tag{16}\]  
For the first 100 samples, the predictive model is not determined, due to the insufficient representativeness of data in the autocovariance matrix, so a simple DPCM prediction model of the first order is used. The weight  
\[c_{\text{OLS}}=\left(s_{err}(n+1)+2\right)^{-\frac{3}{4}} \tag{17}\]  
is dependent on the calculated iterative value  
\[s_{\text{err}}(n+1)=h_{r}s_{\text{err}}(n)+\left|e(n)\right|. \tag{18}\]  
The introduction of \(c_{\text{OLS}}\) is intended to reduce the role of input data for which larger absolute prediction errors \(\left|e(n)\right|\) are obtained. The best compression results were obtained at \(r=20\) (predictor using 10 samples back from both channels) and with forgetting factors \(f_{r}=0.9983\) and \(h_{f}=0.69\).  
The OLS+ method has greater computational complexity than in case of RLS method because of need to inverse the matrix. An advantage of OLS+ is the better efficiency of the predictive model, obtained by using additional operations on autocovariance matrix before it is inverse, according to the Formulas (13), (17), and (18). It is different to the case of the method of fast adaptation in RLS as it applies to the already inverted matrix, which is more sensitive and difficult to determine the common forgetting factor that ensures proper efficiency in all the test base files. For this reason, in the MP4-ALS-M23 forgetting factor has a universal value equal 1.