[FFmpeg-devel] [PATCH/RFC] Remove triplication of compute_lpc_coefs() function

Michael Niedermayer michaelni
Fri Aug 29 03:20:13 CEST 2008


On Thu, Aug 28, 2008 at 02:28:50PM +0200, Vitor Sessak wrote:
> Hi all.
>
> I've finally found a more or less clean way of doing $subj. I also want to 
> know if it is ok to remove the following useless loop:
>
>> for(i=0; i<max_order; i++) lpc_tmp[i] = 0;

all useless loops can be removed ...


Some comments ...
Is the double based code really a problem speedwise? IIRC someone (mans?)
said it was very slow on some ARM, but that considered flac float vs.
double which included the autocorrelation stuff, not just
compute_lpc_coefs() float vs. double IIRC.
It should be clarified how much time is actually spend in this code when
encoding flac.

Also iam still curious if all variables must be double to maintain the good
compression with flac ...

[...]

> +    for(i=0; i<max_order; i++) {
> +        if (normalize) {
> +            r = -autoc[i+1];
> +            for(j=0; j<i; j++) {
> +                r -= lpc_tmp[j] * autoc[i-j];
> +            }
> +            r /= err;
> +        } else
> +            r = -autoc[i];
> +
> +        if (ref)
> +            ref[i] = fabs(r);
> +
> +        err *= 1.0 - (r * r);
> +
> +        i2 = (i >> 1);
> +        lpc_tmp[i] = r;
> +        for(j=0; j<i2; j++) {
> +            tmp = lpc_tmp[j];
> +            lpc_tmp[j] += r * lpc_tmp[i-1-j];
> +            lpc_tmp[i-1-j] += r * tmp;
> +        }
> +        if(i & 1) {
> +            lpc_tmp[j] += lpc_tmp[j] * r;
> +        }
> +
> +        if (lpc)
> +            for(j=0; j<=i; j++) {
> +                lpc[i][j] = -lpc_tmp[j];
> +            }

that - can be avoided by fliping a few signs above


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080829/56a2e40d/attachment.pgp>



More information about the ffmpeg-devel mailing list