[FFmpeg-devel] Make ff_acelp_lsp2lpc() more generic

Michael Niedermayer michaelni
Thu Jun 17 17:29:31 CEST 2010


On Thu, Jun 17, 2010 at 01:10:00PM +0200, Benjamin Larsson wrote:
> 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.

i can live with the if() but i would like this to become higher quality
in terms of knowledge of neccessarity of operations and not just
commited to main svn and forgotten till godot

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100617/0234121e/attachment.pgp>



More information about the ffmpeg-devel mailing list