# [Ffmpeg-cvslog] r5747 - trunk/libavcodec/flacenc.c

Justin Ruggles jruggle
Sun Jul 16 01:46:48 CEST 2006

```Michael Niedermayer wrote:
> Hi
>
> On Fri, Jul 14, 2006 at 08:42:10PM -0400, Justin Ruggles wrote:
> [...]
>
>>I do have a question.  The Levinson-Durbin recursion as implemented
>>essentially calculates all LPC coefficients for each order from 1 to
>>max_order.  Can Cholesky factorization do the same?
>
>
> this is a good question :)
> i think the awnser is no, the problem is that while for Levinson-Durbin
> recursion we assume a infinite block length and in that case the resulting
> autocorrelation matrix will not change depending on the number of LPC
> coefficients, while the actual autocorrelation matrix will change
> following example shows why:
>
>
> for order 3
> audio input:            a b c d e f g h
> samples stored as is:   a b c
> samples predicted   :         d e f g h
>
> for order 2
> audio input:            a b c d e f g h
> samples stored as is:   a b
> samples predicted   :       c d e f g h
>
> the difference is minor of course but so is the difference between
> Levinson-Durbin and Cholesky
>
> if we ignore this, then yes cholesky should be able to output shorter
> predictors too
>
> [...]

I think I get it now.  I always wondered how cutting off the "lag" at
the ends could give accurate results.  Also, it didn't jive with the
formal definition of autocorrelation.  Applying the window function now
makes more sense. Thanks. :)

So, to extend the Cholesky factorization to calculate all orders 1 to
max_order, would we have to do the initialize/update/solve/repeat cycle
for each order or might there be a faster way?  If not, it might be
faster to run Levinson-Durbin first to get a good order, then run
Cholesky to get more accurate coefficients.

-Justin

```