diff lpc.c @ 12139:e59926e2c50c libavcodec

Add AVCodecContext.lpc_type and Add AVCodecContext.lpc_passes fields. Add AVLPCType enum. Deprecate AVCodecContext.use_lpc.
author jbr
date Sun, 11 Jul 2010 16:56:20 +0000
parents fdafbcef52f5
children
line wrap: on
line diff
--- a/lpc.c	Sun Jul 11 14:50:20 2010 +0000
+++ b/lpc.c	Sun Jul 11 16:56:20 2010 +0000
@@ -165,7 +165,8 @@
 int ff_lpc_calc_coefs(DSPContext *s,
                       const int32_t *samples, int blocksize, int min_order,
                       int max_order, int precision,
-                      int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc,
+                      int32_t coefs[][MAX_LPC_ORDER], int *shift,
+                      enum AVLPCType lpc_type, int lpc_passes,
                       int omethod, int max_shift, int zero_shift)
 {
     double autoc[MAX_LPC_ORDER+1];
@@ -174,20 +175,21 @@
     int i, j, pass;
     int opt_order;
 
-    assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && use_lpc > 0);
+    assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER &&
+           lpc_type > AV_LPC_TYPE_FIXED);
 
-    if(use_lpc == 1){
+    if (lpc_type == AV_LPC_TYPE_LEVINSON) {
         s->lpc_compute_autocorr(samples, blocksize, max_order, autoc);
 
         compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
 
         for(i=0; i<max_order; i++)
             ref[i] = fabs(lpc[i][i]);
-    }else{
+    } else if (lpc_type == AV_LPC_TYPE_CHOLESKY) {
         LLSModel m[2];
         double var[MAX_LPC_ORDER+1], av_uninit(weight);
 
-        for(pass=0; pass<use_lpc-1; pass++){
+        for(pass=0; pass<lpc_passes; pass++){
             av_init_lls(&m[pass&1], max_order);
 
             weight=0;