[Ffmpeg-devel] [PATCH] wma table optimization

Michael Niedermayer michaelni
Sat Aug 19 14:06:17 CEST 2006


Hi

On Sat, Aug 19, 2006 at 12:56:21PM +0200, Benjamin Larsson wrote:
> This is an old revised table generation patch. The old patch didn't
> generate large enough tables and thus some samples failed.
> (http://klif-e.mos.net.au/videos/extr.wmv).
> <http://klif-e.mos.net.au/videos/extr.wmv>
> 
> With this patch the decoding time on my test sample went down from about 13.6 -> 13.0 secs. Around a 5% improvmement in decodetime. Unfortunaly I'm not sure how large the tables need to be so I just set a size I thought would be safe. With the extr sample I got a maximum index of 131.

either add a if() to check if the index is within the table or instead
of implementing things like:

someloop{
    v += get_vlc/get_bits - 1234;
    my_float= table[v]; // my_float= pow(somebase, v);
}

implement it like:

someloop{
    v = get_vlc/get_bits;
    my_float*= table[v]; // my_float*= pow(somebase, v - 1234);
}


[...]

> Index: libavcodec/wmadec.c
> ===================================================================
> --- libavcodec/wmadec.c	(revision 6026)
> +++ libavcodec/wmadec.c	(working copy)
> @@ -131,6 +131,9 @@
>      float lsp_pow_m_table1[(1 << LSP_POW_BITS)];
>      float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
>      DSPContext dsp;
> +    /* pow tables */
> +    float pow_005_10[256];
> +    float pow_00625_10[256];

duplicating constant tables per codec instance

[...]
>  
>              coefs1 = s->coefs1[ch];
>              exponents = s->exponents[ch];
> -            mult = pow(10, total_gain * 0.05) / s->max_exponent[ch];
> +            mult = s->pow_005_10[total_gain] / s->max_exponent[ch];

total_gain is constant within that loop

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

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list