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

Justin Ruggles justin.ruggles
Fri Jan 21 01:14:00 CET 2011


On 01/19/2011 09:46 PM, M?ns Rullg?rd wrote:

> 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.


I decided to skip this patch for now.  I only moved the parameters
necessary for calculating the windowed_samples buffer size.  That was
included in the window function split patch.

-Justin



More information about the ffmpeg-devel mailing list