[FFmpeg-devel] [PATCH] Common ACELP routines (3/3) - LPC decoding routines
Vladimir Voroshilov
voroshil
Fri Apr 25 17:34:56 CEST 2008
Michael Niedermayer wrote:
> On Fri, Apr 25, 2008 at 10:24:25AM +0700, Vladimir Voroshilov wrote:
> > Michael Niedermayer wrote:
> > > On Fri, Apr 25, 2008 at 08:26:35AM +0700, Vladimir Voroshilov wrote:
> > > [...]
> > > > +void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max)
> > > > +{
> > > > + int i, j;
> > > > +
> > > > + /* sort lsfq in ascending order. float bubble agorithm, O(n)*/
> > >
> > > > + for(i=9; i<9; i++)
> > >
> > > i do not think that will work
> >
> > It passed all tests what means that data were already ordered.
> > Anyway since there is nothing in spec about LSFs ordering I'd
> > prefer keep sorting there.
> [...]
>
> > +/**
> > + * \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_32_16(f[j-1]>>1, lsp[2*i-2])<<2) - f[j-2];
> > +#else
> > + f[j] -= (mul_32_16(f[j-1], lsp[2*i-2])<<1) - f[j-2];
>
> mul_32_16 does >>15, you do <<1 afterwards, thats redundant and looses
> precission, you could as well >> by 14
I've found that i can use existing MULH and MULL (and replaced it
everywhere in local tree already).
I've defined FRAC_BITS=15 before including mathops.h and
called MULL everywhere except this place.
I'm trying to eliminate extra shifts here by reducing fixed point base
(looks like two least significant bits of f[i] are always zero, but I'm not
sure).
>
>
> [...]
> > +/**
> > + * \brief Convert LSF to LSP
> > + * \param lsp [out] LSP coefficients (-(1<<15) <= lsp < (1<<15))
> > + * \param lsf LSF coefficients (0 <= lsf < PI * (1<<13))
> > + *
> > + * \remark It is safe to pass the same array in lsf and lsp parameters
> > + */
> > +void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp);
>
> the comment and the function names contradict each other lsp2lpc vs. lsf2lsp
>
>
> > +
> > +/**
> > + * \brief LSP to LP conversion (3.2.6 of G.729)
> > + * \param lp [out] (Q12) decoded LP coefficients
> > + * \param lsp (Q15) LSP coefficients
> > + */
> > +void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf);
> same issue
Fixed in local tree.
> also please change the Q12/15 notation to some normal fixed point one with
> min/one/max
Like this?:
/**
* \param param1 bla bla bla
...
* \return some value
*
* allowed values for param1:
* min: -0x10000
* max: 0x10000
* one 0x01000
*/
Or something different?
Give me sample please.
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
Omsk State University
JID: voroshil at jabber.ru
ICQ: 95587719
More information about the ffmpeg-devel
mailing list