[FFmpeg-devel] Make ff_acelp_lsp2lpc() more generic

Benjamin Larsson banan
Wed Jun 16 15:47:44 CEST 2010


M?ns Rullg?rd skrev 2010-06-16 15:36:
> Mohamed Naufal<naufal11 at gmail.com>  writes:
>
>    
>> Hi
>>
>> The attached patch allows using the function by both G.729&  G.723.1.
>>
>> -void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order)
>> +void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order, int shift, int rounder, int sign)
>>   {
>>       int i;
>>       int f1[lp_half_order+1]; // (3.22)
>> @@ -103,9 +103,10 @@ void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order)
>>           int ff1 = f1[i] + f1[i-1]; // (3.22)
>>           int ff2 = f2[i] - f2[i-1]; // (3.22)
>>
>> -        ff1 += 1<<  10; // for rounding
>> -        lp[i]    = (ff1 + ff2)>>  11; // divide by 2 and (3.22) ->  (3.12)
>> -        lp[(lp_half_order<<  1) + 1 - i] = (ff1 - ff2)>>  11; // divide by 2 and (3.22) ->  (3.12)
>> +        ff1 += rounder; // for rounding
>> +        // divide by 2 and scale
>> +        lp[i]    = av_clip_int16(sign * av_clip_int16((ff1 + ff2)>>  (shift + 1)));
>> +        lp[(lp_half_order<<  1) + 1 - i] = av_clip_int16(sign * av_clip_int16((ff1 - ff2)>>  (shift + 1)));
>>      
> That clipping will probably have a severe performance impact.  Did you
> benchmark this?
>
>    

For the record this code is unused so far.

MvH
Benjamin Larsson




More information about the ffmpeg-devel mailing list