[FFmpeg-devel] [PATCH] Common ACELP routines (3/3) - LPC decoding routines

Vladimir Voroshilov voroshil
Thu Apr 24 16:44:17 CEST 2008


On Thu, Apr 24, 2008 at 7:21 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Apr 24, 2008 at 02:53:33AM +0700, Vladimir Voroshilov wrote:
>  > Michael Niedermayer wrote:
>  [...]
>
> >
>  > >
>  > > [...]
>  > > > +void ff_acelp_reorder_lsf(int16_t* lsfq, int16_t lsfq_min_distance, int16_t lsfq_min, int16_t lsfq_max)
>  > > > +{
>  > > > +    int i;
>  > > > +
>  > > > +    lsfq[0] = FFMAX(lsfq[0], lsfq_min); //Is warning required ?
>  > > > +
>  > > > +    for(i=0;i<9; i++)
>  > > > +        lsfq[i+1] = FFMAX(lsfq[i+1], lsfq[i] + lsfq_min_distance);
>  > >
>  > > simplification stolen from soc/amrnbdec.c:
>  > >
>  > > for(i=0; i<10; i++){
>  > >     lsf[i] = FFMAX(lsf[i], lsf_min);
>  > >     lsf_min = lsf[i] + min_distance;
>  > > }
>  > >
>  > > also id make lsfq_min_distance and lsfq_min/max int
>  > >
>  > > ahh, and reorder_lsf() in soc/amrnbdec.c is buggy (uninitalized var)
>  >
>  > It also assumes that LSFs already ordered.
>  > G.729 explicitly sorts them.
>  > Should i put sorting code inside routine?
>
>  If its fast for the case that they are already sorted ...

It was written by you :)

>  > +/**
>  > + * \brief decodes polynomial coefficients from LSP
>
> > + * \param f [out] (Q24) decoded polynomial coefficients
>  > + * \param lsp (Q15) LSP coefficients
>  > + */
>  > +static void lsp2poly(int* f, const int16_t* lsp)
>
> > +{
>  > +    int i, j;
>  > +
>  > +    f[0] = 0x1000000;          // 1.0 in Q24
>  > +    f[1] = -lsp[0] << 10;      // *2 and Q15 -> Q24
>  > +
>  > +    for(i=2; i<=5; i++)
>  > +    {
>  > +        f[i] = f[i-2];
>  > +
>  > +        for(j=i; j>1; j--)
>  > +#ifdef G729_BITEXACT
>
> > +            f[j] -= (mul_24_15(f[j-1]>>1, lsp[2*i-2])<<2) - f[j-2];
>  > +#else
>
>  > +            f[j] -= (mul_24_15(f[j-1], lsp[2*i-2])<<1) - f[j-2];
>
>  Does this need the cliping from mul_24_15() ? or can it be replaced
>  by a simple * (int64_t) ?

Clipping is required (absence leads to all tests failure).

-- 
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: acelp_lpc_23.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080424/c863177a/attachment.asc>



More information about the ffmpeg-devel mailing list