[FFmpeg-devel] Make ff_acelp_lsp2lpc() more generic

Benjamin Larsson banan
Thu Jun 17 13:10:00 CEST 2010


Michael Niedermayer skrev 2010-06-16 17:41:
> On Wed, Jun 16, 2010 at 02:36:44PM +0100, M?ns Rullg?rd wrote:
>    
>> 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?
>>      
> also, some of the cliping is clearly unneeded
> and we need to find out of what remains is needed
>    
>

I told naufal to focus on completing the decoder. I see 4 options. 
Duplicate the  function, add a g723.1 flag, add more function arguments 
like the patch or just ignore bit exactness.

I think the best and least complex solution is to add a g723.1 flag and 
add a conditional in the loop, "if (g723.1) do this; else do that". This 
code is executed every subframe (4 times per frame I think). So I think 
a conditional would be an ok compromise. It is not possible to benchmark 
the slowdown for the g729 decoder as the complete decoder never got merged.

MvH
Benjamin Larsson




More information about the ffmpeg-devel mailing list