}
}
-void ff_acelp_lspd2lpc(const double *lsp, float *lpc)
+void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
{
- double pa[6], qa[6];
- int i;
+ double pa[lp_half_order+1], qa[lp_half_order+1];
+ float *lpc2 = lpc + (lp_half_order << 1) - 1;
- lsp2polyf(lsp, pa, 5);
- lsp2polyf(lsp + 1, qa, 5);
+ lsp2polyf(lsp, pa, lp_half_order);
+ lsp2polyf(lsp + 1, qa, lp_half_order);
- for (i=4; i>=0; i--)
- {
- double paf = pa[i+1] + pa[i];
- double qaf = qa[i+1] - qa[i];
+ while (lp_half_order--) {
+ double paf = pa[lp_half_order+1] + pa[lp_half_order];
+ double qaf = qa[lp_half_order+1] - qa[lp_half_order];
- lpc[i ] = 0.5*(paf+qaf);
- lpc[9-i] = 0.5*(paf-qaf);
+ lpc [ lp_half_order] = 0.5*(paf+qaf);
+ lpc2[-lp_half_order] = 0.5*(paf-qaf);
}
}
* @param lsp line spectral pairs in cosine domain
* @param lpc linear predictive coding coefficients
*
+ * @note buffers should have a minimux size of 2*lp_half_order elements.
+ *
* TIA/EIA/IS-733 2.4.3.3.5
*/
-void ff_acelp_lspd2lpc(const double *lsp, float *lpc);
+void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order);
#endif /* AVCODEC_LSP_H */
for (i=0; i<10; i++)
lsp[i] = cos(M_PI * lspf[i]);
- ff_acelp_lspd2lpc(lsp, lpc);
+ ff_acelp_lspd2lpc(lsp, lpc, 5);
for (i=0; i<10; i++)
{