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

Michael Niedermayer michaelni
Sun Aug 31 01:34:04 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 

going back to this patch ...

after some tests, ive not been able to find a compute_lpc_coefs() with floats
that results in acceptable compression
btw, my tests gave:
27063400
vs.
27731934
which is a little worse than the 0.4% quoted ... (so much for the, it doesnt
matter)

using http://www.gnu.org/fun/jokes/eternal-flame.ogg

so lets see if we can improve this patch ...

[...]

> +    if ((autoc[max_order] == 0 || autoc[0] <= 0) && fail)
> +        return -1;

fail should be first


> +
> +    for(i=0; i<max_order; i++) lpc_tmp[i] = 0;
> +    err = autoc[0];
> +
> +    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];
> +            }

is this really needed?
cant a simple
lpc+= stride;
be used to decide if space gets reused or all intermediates get exported?


> +
> +        if (err < 0 && fail)
> +            return -1;

fail should be first



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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- 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/20080831/b8bdefa5/attachment.pgp>



More information about the ffmpeg-devel mailing list