[FFmpeg-devel] [PATCH 2/4] Move some of the ff_lpc_calc_coefs() parameters to LPCContext.

Måns Rullgård mans
Thu Jan 20 03:46:46 CET 2011


Justin Ruggles <justin.ruggles at gmail.com> writes:

> ---
>  libavcodec/alacenc.c  |   13 ++++-----
>  libavcodec/flacenc.c  |   14 ++++++----
>  libavcodec/lpc.c      |   68 ++++++++++++++++++++++++++++--------------------
>  libavcodec/lpc.h      |   40 +++++++++++++++++++++++------
>  libavcodec/ra144enc.c |    8 +++---
>  5 files changed, 90 insertions(+), 53 deletions(-)
>
>
> diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
> index 5fd1e19..099c26f 100644
> --- a/libavcodec/lpc.c
> +++ b/libavcodec/lpc.c

[...]

> +    } else if (s->lpc_type == AV_LPC_TYPE_CHOLESKY) {
>          LLSModel m[2];
>          double var[MAX_LPC_ORDER+1], av_uninit(weight);
>  
> -        for(pass=0; pass<lpc_passes; pass++){
> +        for(pass=0; pass<s->lpc_passes; pass++){
>              av_init_lls(&m[pass&1], max_order);
>  
>              weight=0;
> -            for(i=max_order; i<blocksize; i++){
> -                for(j=0; j<=max_order; j++)
> +            for(i=max_order; i<s->blocksize; i++){
> +                for(j=0; j<=s->max_order; j++)
>                      var[j]= samples[i-j];

Loading some of the struct members into local variables can give
better code.  If this is at all speed sensitive such effects should be
checked.  I have often seen gcc reload the loop limit (rather than
keeping it in a register) on each iteration with code like this.

No other comments on this patch.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list