[FFmpeg-devel] [PATCH] Common ACELP routines (2/3) - filters

Robert Swain robert.swain
Wed Apr 23 23:23:56 CEST 2008


On 23 Apr 2008, at 22:07, Michael Niedermayer wrote:
> On Thu, Apr 24, 2008 at 02:15:51AM +0700, Vladimir Voroshilov wrote:
>> Michael Niedermayer wrote:
> [...]
>>>> +        v=0;
>>>> +        for(i=0; i<10; i++)
>>>> +        {
>>>
>>>> +            /*  R(x):=ac_v[-k+x] */
>>>> +            v += ac_v[n - pitch_delay_int - i    ] *  
>>>> ff_g729_interp_filter[i][    pitch_delay_frac];
>>>> +            v = av_clip(v, -0x40000000, 0x3fffffff); //v += R(n- 
>>>> i)*ff_g729_interp_filter(t+3i)
>>>> +            v += ac_v[n - pitch_delay_int + i + 1] *  
>>>> ff_g729_interp_filter[i][3 - pitch_delay_frac];
>>>> +            v = av_clip(v, -0x40000000, 0x3fffffff); //v += R(n+i 
>>>> +1)*ff_g729_interp_filter(3-t+3i)
>>>
>>> The cliping is incorrect for generic code. Also i doubt g729  
>>> really needs
>>> it. What happens without that cliping or at least with it at the  
>>> end, just
>>> before storing in ac_v?
>>
>> Removing those line breaks OVERFLOW test (regardless of clipping  
>> outside loop),
>> significantly reduces PSNR from bitexact's 99,99 to 18,54 without  
>> outside
>> clipping and to 26,01 with it.
>
> What is the OVERFLOW test anyway? Is this a normal valid bitstream  
> generated
> from a pcm wave? Or some sythetic overflow excercise which cannot be  
> generated
> by any input wave?
> (If you dont know you can test it by encoding the wave from overflow  
> to see if
> there are still any overflows happening from the resulting bitstream)

AMR does some overflow detection during synthesis.

http://wiki.multimedia.cx/index.php?title=AMR-NB#Additional_instability_protection

"If an overflow occurs during synthesis, the pitch vector, v(n), is  
scaled down by a factor of 4 and synthesis is conducted again  
bypassing emphasising the pitch vector contribution and adaptive gain  
control."

I don't know if this is relevant to this discussion though I see there  
is overflow detection in the synthesis filter for this G.729 code too.

Rob




More information about the ffmpeg-devel mailing list