]> git.sesse.net Git - ffmpeg/commitdiff
lpc: Add a function for calculating reflection coefficients from samples
authorMartin Storsjö <martin@martin.st>
Thu, 25 Oct 2012 12:33:15 +0000 (15:33 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 29 Oct 2012 19:53:16 +0000 (21:53 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/lpc.c
libavcodec/lpc.h

index 126dbc12668e3cf98703b039c9e49011a973bcc0..2093e7e8027fa6433dba5cb7c1cb9b65d775b2bb 100644 (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
  *
index 0e54f0dfab09d5aaab32f85906f10ae4f9da1978..659060869369d45939f1e6431117e5e033451b1b 100644 (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.
  */