# [flac-dev] Confusion about linear prediction within flac

Robin Patrick Decker robin at decker.cx
Thu Sep 13 20:08:23 UTC 2018

```Thank you for the clarification. It has helped tremendously!

I'm a little unsure about how the autocorrolation is calculated. For
the calculation of the autocorrolation with lag i, x(n)x(n-i) is looped
and summed through from n = 0 to the length of the original signal.
This summation is then divided by the length of the signal (I'm
assuming this is what expected value means?). i is then increased from
1 to p (model order) to create an array of autocorrolations with
different lags. Am I understanding this correctly?

Thanks again for all the help.

Kind Regards,
Robin

On Sun, 2018-09-09 at 13:01 -0700, Timothy B. Terriberry wrote:
> Robin Patrick Decker wrote:
> > I would really appriciate an explanation or information on a good
> > resource to learn more about how the prediction coefficients are
> > solved
> > for.
>
> The Wikipedia page on this subject is not terrible:
> https://en.wikipedia.org/wiki/Linear_prediction
>
> The very high-level answer is that if want to choose your
> coefficients
> to minimize the mean squared error of the prediction, then you get a
> least-squares problem where the matrix you're inverting is just the
> auto-correlation matrix of your signal (the Yule-Walker equations).
> The
> discrete Fourier transform is just a computationally efficient means
> of
> computing the auto-correlation, at least if your order is
> sufficiently high.
>
> > Once the lpc coefficients have been solved, as far as I understand
> > you
> > must also store part of original signal with length equal to the
> > prediction order since you need the previous samples to predict the
> > next sample of which only the residual is known. For the next
> > values
> > the  residual is used to retrieve the original value which is fed
> > into
> > the predction model to further reconstruct the time series. Is this
> > correct?
>
> Yes.

```

More information about the flac-dev mailing list