[FFmpeg-cvslog] lpc: Add a function for calculating reflection coefficients from samples

Martin Storsjö git at videolan.org
Tue Oct 30 15:16:38 CET 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Oct 25 15:33:15 2012 +0300| [8b25a20efbf4ca261bcd3327a385330eca775ec6] | committer: Martin Storsjö

lpc: Add a function for calculating reflection coefficients from samples

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b25a20efbf4ca261bcd3327a385330eca775ec6
---

 libavcodec/lpc.c |   12 ++++++++++++
 libavcodec/lpc.h |    3 +++
 2 files changed, 15 insertions(+)

diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 126dbc1..2093e7e 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -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
  *
diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
index 0e54f0d..6590608 100644
--- a/libavcodec/lpc.h
+++ b/libavcodec/lpc.h
@@ -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.
  */



More information about the ffmpeg-cvslog mailing list