Commit 1e1e02ea authored by Colin McQuillan's avatar Colin McQuillan Committed by Robert Swain

Make the LSP naming more consistent

Use the convention from lsp.c: an LSF is a frequency, an LSP is the
cosine of an LSF, and LSP functions should have an ff_acelp prefix.
Use a "d" suffix to specify doubles.

Patch by Colin McQuillan ( m.niloc googlemail com )

Originally committed as revision 19570 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b5fe06ab
...@@ -34,21 +34,21 @@ ...@@ -34,21 +34,21 @@
* needed for LSP to LPC conversion. * needed for LSP to LPC conversion.
* We only need to calculate the 6 first elements of the polynomial. * We only need to calculate the 6 first elements of the polynomial.
* *
* @param lspf line spectral pair frequencies * @param lsp line spectral pairs in cosine domain
* @param f [out] polynomial input/output as a vector * @param f [out] polynomial input/output as a vector
* *
* TIA/EIA/IS-733 2.4.3.3.5-1/2 * TIA/EIA/IS-733 2.4.3.3.5-1/2
*/ */
static void lsp2polyf(const double *lspf, double *f, int lp_half_order) static void lsp2polyf(const double *lsp, double *f, int lp_half_order)
{ {
int i, j; int i, j;
f[0] = 1.0; f[0] = 1.0;
f[1] = -2 * lspf[0]; f[1] = -2 * lsp[0];
lspf -= 2; lsp -= 2;
for(i=2; i<=lp_half_order; i++) for(i=2; i<=lp_half_order; i++)
{ {
double val = -2 * lspf[2*i]; double val = -2 * lsp[2*i];
f[i] = val * f[i-1] + 2*f[i-2]; f[i] = val * f[i-1] + 2*f[i-2];
for(j=i-1; j>1; j--) for(j=i-1; j>1; j--)
f[j] += f[j-1] * val + f[j-2]; f[j] += f[j-1] * val + f[j-2];
...@@ -59,16 +59,16 @@ static void lsp2polyf(const double *lspf, double *f, int lp_half_order) ...@@ -59,16 +59,16 @@ static void lsp2polyf(const double *lspf, double *f, int lp_half_order)
/** /**
* Reconstructs LPC coefficients from the line spectral pair frequencies. * Reconstructs LPC coefficients from the line spectral pair frequencies.
* *
* @param lspf line spectral pair frequencies * @param lsp line spectral pairs in cosine domain
* @param lpc linear predictive coding coefficients * @param lpc linear predictive coding coefficients
*/ */
void ff_celp_lspf2lpc(const double *lspf, float *lpc) void ff_acelp_lspd2lpc(const double *lsp, float *lpc)
{ {
double pa[6], qa[6]; double pa[6], qa[6];
int i; int i;
lsp2polyf(lspf, pa, 5); lsp2polyf(lsp, pa, 5);
lsp2polyf(lspf + 1, qa, 5); lsp2polyf(lsp + 1, qa, 5);
for (i=4; i>=0; i--) for (i=4; i>=0; i--)
{ {
......
...@@ -80,7 +80,7 @@ typedef struct ...@@ -80,7 +80,7 @@ typedef struct
* *
* TIA/EIA/IS-733 2.4.3.3.5 * TIA/EIA/IS-733 2.4.3.3.5
*/ */
void ff_celp_lspf2lpc(const double *lspf, float *lpc); void ff_acelp_lspd2lpc(const double *lsp, float *lpc);
/** /**
* Initialize the speech codec according to the specification. * Initialize the speech codec according to the specification.
...@@ -604,14 +604,14 @@ static void apply_pitch_filters(QCELPContext *q, float *cdn_vector) ...@@ -604,14 +604,14 @@ static void apply_pitch_filters(QCELPContext *q, float *cdn_vector)
*/ */
static void lspf2lpc(const float *lspf, float *lpc) static void lspf2lpc(const float *lspf, float *lpc)
{ {
double lsf[10]; double lsp[10];
double bandwidth_expansion_coeff = QCELP_BANDWIDTH_EXPANSION_COEFF; double bandwidth_expansion_coeff = QCELP_BANDWIDTH_EXPANSION_COEFF;
int i; int i;
for (i=0; i<10; i++) for (i=0; i<10; i++)
lsf[i] = cos(M_PI * lspf[i]); lsp[i] = cos(M_PI * lspf[i]);
ff_celp_lspf2lpc(lsf, lpc); ff_acelp_lspd2lpc(lsp, lpc);
for (i=0; i<10; i++) for (i=0; i<10; i++)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment