From 8b25a20efbf4ca261bcd3327a385330eca775ec6 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Thu, 25 Oct 2012 15:33:15 +0300 Subject: lpc: Add a function for calculating reflection coefficients from samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/lpc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libavcodec/lpc.c') diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 126dbc1266..2093e7e802 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 * -- cgit v1.2.3