Browse Source

lpc: Add a function for calculating reflection coefficients from samples

Signed-off-by: Martin Storsjö <martin@martin.st>
tags/n1.1
Martin Storsjö 13 years ago
parent
commit
8b25a20efb
2 changed files with 15 additions and 0 deletions
  1. +12
    -0
      libavcodec/lpc.c
  2. +3
    -0
      libavcodec/lpc.h

+ 12
- 0
libavcodec/lpc.c View File

@@ -148,6 +148,18 @@ static int estimate_best_order(double *ref, int min_order, int max_order)
return est;
}

int ff_lpc_calc_ref_coefs(LPCContext *s,
const int32_t *samples, int order, double *ref)
{
double autoc[MAX_LPC_ORDER + 1];

s->lpc_apply_welch_window(samples, s->blocksize, s->windowed_samples);
s->lpc_compute_autocorr(s->windowed_samples, s->blocksize, order, autoc);
compute_ref_coefs(autoc, order, ref, NULL);

return order;
}

/**
* Calculate LPC coefficients for multiple orders
*


+ 3
- 0
libavcodec/lpc.h View File

@@ -92,6 +92,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
enum FFLPCType lpc_type, int lpc_passes,
int omethod, int max_shift, int zero_shift);

int ff_lpc_calc_ref_coefs(LPCContext *s,
const int32_t *samples, int order, double *ref);

/**
* Initialize LPCContext.
*/


Loading…
Cancel
Save