[FFmpeg-devel] [PATCH] Common ACELP routines (3/3) - LPC decoding routines
Michael Niedermayer
michaelni
Fri Apr 25 17:11:59 CEST 2008
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
[...]
> +/**
> + * \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
also please change the Q12/15 notation to some normal fixed point one with
min/one/max
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I wish the Xiph folks would stop pretending they've got something they
do not. Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- 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/20080425/070263c7/attachment.pgp>
More information about the ffmpeg-devel
mailing list