[FFmpeg-devel] [PATCH] G.729A (now fixed-point) decoder

Vladimir Voroshilov voroshil
Thu Mar 20 14:25:36 CET 2008


Hi, Reimar
Thanks for review.

On Wed, Mar 19, 2008 at 8:10 PM, Reimar D?ffinger
<Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
> Hello,
>
> On Sun, Mar 16, 2008 at 12:24:58AM +0600, Vladimir Voroshilov wrote:

[...]

>  > +static int sum_of_squares(const int16_t* speech, int cycles, int offset, int shift)
>  > +{
>  > +    int n;
>  > +    int sum = 0;
>  > +
>  > +    if(offset < 0)
>  > +        return 0;
>  > +
>  > +    for(n=0; n<cycles; n++)
>  > +       sum += (speech[n] >> shift) * (speech[n + offset] >> shift);
>
>  Since "speech" is 16 bit, why not
>  (speech[n] * speech[n + offset]) >> shift,
>  or does the specification not want that?
>  Probably not good since it won't match the specification,
>  but making sum 64 bit and shifting only at the very end
>  probably is faster even on 32 bit systems.

Convertion to 64 bit decreases PSNR in ALGTHM, LSP ans TEST tests,
insreasing it in others. Thus i'll keep code as is for a while.

>  > +        Azg[n] = (Az[n] * gamma_pow) >> 15;
>  > +        gamma_pow = (gamma_pow * gamma) >> 15;
>
>  Btw. I think you should probably try using MULL from mathops.h, it might
>  be slower though since it is for 32*32 bit multiplication.

MULL is just 64-bit multiplication and requires "fixed" (predefined
via macro) fixed-point position.
Current code successfully fits into 32 bit and does not have such restriction.
I don't see real advantage of using MULL yet..

>  > +static void g729a_tilt_compensation(G729A_Context *ctx, const int16_t *lp_gn, const int16_t *lp_gd, int16_t* res_pst)
>  > +{
>  > +    int tmp;
>  > +    int gt;      // Q12
>  > +    int rh1,rh0; // Q12
>  > +    int16_t hf_buf[11+22]; // Q12 A(Z/GAMMA_N)/A(z/GAMMA_D) filter impulse response
>  > +    int sum;
>  > +    int i, n;
>  > +
>  > +    memset(hf_buf, 0, 33 * sizeof(int16_t));
>
>  I don't think it is necessary to zero all of these.

It is. Zeroed values (not filled via first for loop) are used in second loop.


All other issues are fixed successfully.


-- 
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719




More information about the ffmpeg-devel mailing list